fix: support objects with null prototype as HeadersInit#81
fix: support objects with null prototype as HeadersInit#81kettanaito merged 4 commits intomswjs:mainfrom
HeadersInit#81Conversation
|
To provide more context, I would like to use this polyfill in an environment that lacks a lot of the web standards and get the axios library working. To that end, I've also set up a shim fetch function that uses this polyfill. When axios accepts a set of headers, it internally converts that to an object and constructs it with the null prototype here, before passing that object into the shim fetch function. The fetch function then wraps the object in a Headers instance. This is where I get the above error. I can work around this for now by changing the shim fetch function implementation, but @kettanaito I'd like to hear your thoughts on whether you'd accept this contribution here, because wrapping an object with the null prototype in a Headers instance appears to work fine in the browser and Node.js. |
HeadersInit
kettanaito
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks for adding this, @tmisirpash.
HeadersInitHeadersInit
Released: v5.0.1 🎉This has been released in v5.0.1. Get these changes by running the following command: Predictable release automation by Release. |
Currently, if an object is created with the null prototype, e.g.
attempting to instantiate a
Headersobject with this polyfill throws an error:because
headers.constructoris undefined.@kettanaito