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

Intercepting POST-requests handled by ky http client throws an TypeError "this._options.headers.get is not a function" #651

Closed
inxmail-de-cln opened this issue Oct 2, 2024 · 4 comments · Fixed by #660

Comments

@inxmail-de-cln
Copy link

When setting up intercepting POST-requests with MSW which are being handled by ky ( https://github.com/sindresorhus/ky ) I ran into an TypeError "this._options.headers.get is not a function" being raised in this line: https://github.com/sindresorhus/ky/blob/3ba40cc6333cf1847c02c51744e22ab7c04407f5/source/core/Ky.ts#L181

Since this behaviour occurs in MSW versions later than 2.4.3 I guess the issue is being right filed here.

@paoloricciuti
Copy link
Contributor

paoloricciuti commented Oct 15, 2024

Just had the same problem with sveltekit...the problem is likely because this line

return Reflect.get(headers, kRawHeaders) || []

it's falling back to an empty array which is not an instance of headers so it doesn't have the get method on it. Ok scratch that i tried to patch the package and it still doesn't work...the problem is likely introduced by this like but not because it's an empty array,

@paoloricciuti
Copy link
Contributor

Small update...it was actually not that PR but probably the one before that introduced the bug

https://github.com/mswjs/interceptors/pull/640/files

@kettanaito
Copy link
Member

Released: v0.36.5 🎉

This has been released in v0.36.5!

Make sure to always update to the latest version (npm i @mswjs/interceptors@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

@inxmail-de-cln
Copy link
Author

Thank you very much! This will help us a lot!

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 a pull request may close this issue.

3 participants