fetch-wrap icon indicating copy to clipboard operation
fetch-wrap copied to clipboard

Using the Header object breaks header merging

Open sdwio opened this issue 7 years ago • 2 comments

Using the header object in a fetch call

    headers: new Headers(
        {
          "Content-Type": "application/json",
         }
      ),

instead of just

    headers: {
        "Content-Type": "application/json",
       }

will cause the merging of headers as show in the documentation to fail. Only the header(s) given in the fetch call will be used.

If a fix or warning for this is not desirable, could it be at least mentioned in the documentation? Depending on which solution you prefer I will gladly create a pull request.

sdwio avatar Sep 10 '17 05:09 sdwio

sorry for the delay, just saw this. if feasible (and by glancing at Headers object API it seems like it should), I'd try to support it, accepting any (Headers object or plain object) transparently. pull-request would be welcome 👍

benjamine avatar Oct 18 '17 04:10 benjamine

Sorry for the wayyyy longer delay on my side. But once I was working around the problem, your library did just fit in perfectly, so I never thought about it again. I will try to look into it in the next weeks and set up a pull request.

sdwio avatar Apr 26 '18 05:04 sdwio