Skip to content
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

Adds support for options.headers to be a Headers instance with an entries method (#124) #125

Closed

Conversation

joseph-galindo
Copy link

@joseph-galindo joseph-galindo commented Oct 12, 2019

This PR is fixing the issue outlined in (#124). This allows consumers to use a Headers instance in their raw fetch(url, options) call for options.headers, instead of being limited to only JavaScript object literals.

The polyfill will now check if options.headers has an entries() function. If it does, it will invoke that and expect to receive an iterable object, like the Headers.entries() API does, and then iterate over that.

With this change, request headers as a Headers instance will be properly iterated and carried over correctly to the underlying XHR, instead of the current implementation which iterates on the method keys (append(), delete(), etc)

Unfortunately I could not add this support while keeping the original package under 500b, so I plan to limit these changes to my personal fork of unfetch.

EDIT: closing this PR, accidentally opened it against the main repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant