-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polyfill does not properly iterate options.headers, if they are an instance of window.Headers #124
Comments
On second thought, it looks like support for I will still create the PR, but may need to fork if this codebase would prefer to not have support for these APIs. |
I have made the changes to add the support I needed, but unfortunately could not add them without notable size increases (up to 550b). With that in mind I plan to limit these changes to my fork, and will close this issue. |
Hey, guys. When are you going to release this fix? |
@dmitryt I ended up closing the PR against developit/unfetch since the proposed changes would exceed the size constraints. I have a fork with the changes hosted on my personal github, but I did not have plans to publish it to the public npm registry. I currently only use my fork as a code mirror within my employer's closed-source codebase. If you want to use the fork, I think your package.json could link to it directly using the git url. If you want to see these changes make it into the mainline developit/fetch, I could reopen this issue and the corresponding PR, but I am hard-pressed to fit this work into the size constraints. |
Hey,
I am liking this polyfill, but I noticed a minor issue when trying to polyfill fetch calls that use an
options.headers
that are an instance ofwindow.Headers
instead of a simple object literal.In this case, the loop here: https://github.com/developit/unfetch/blob/master/src/index.mjs#L41-L43
Tries to loop it as a normal object literal, giving output like this:
I think this loop needs to be updated to check if:
window.Headers exists
options.headers instanceof window.Headers
If both are true, they can be iterated on using https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries, instead of a simple for...in loop
For the sample case above:
I plan to open a PR for this today, but wanted to write the issue first
The text was updated successfully, but these errors were encountered: