Pre-Chromium Microsoft Edge blows up when undefined is passed as an argument to the window.Headers constructor. As such, ky blows up when trying to make a request due to these lines.
Thanks for the quick response. Would you be open to a pull request to patch it for Edge?
Does it work if you pass null? Personally, I'm fine with adding a simple ternary. But yeah, earlier versions of Edge may have other problems too, as they are unsupported.
Nope, it blows up with null the same as it does with undefined. Chromium and Firefox blow up with null as well (they work fine when passed undefined, however).
Fwiw, we used patch-package and added a nullish coalescing operator to handle the undefined case and it's been working so far. Though, we aren't using any of the more advanced features.
// we changed this
const result = new globals.Headers(source1);
// to this
const result = new globals.Headers(source1 ?? {});
Though, to provide better support when using it without transpiling, I believe a simple || would work as well.
Chrome version 49 has the same problem
This hit us the hard way...
@belgattitude if you need a quick fix till there's a release with this fix in it, we've had good luck using patch-package since it's such a small change.
Thanks ! I did a separate release (https://github.com/sindresorhus/ky/pull/264#issuecomment-652431596)... But good to know about patch-package I'll use it for sure
Most helpful comment
Fwiw, we used
patch-packageand added a nullish coalescing operator to handle theundefinedcase and it's been working so far. Though, we aren't using any of the more advanced features.Though, to provide better support when using it without transpiling, I believe a simple
||would work as well.