-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Headers is undefined when not handling request #1120
Comments
Hey, @kentcdodds. Thanks for reporting this! The issue seems related to mswjs/interceptors#212. Node 12 is the latest officially supported version for MSW. We will upgrade to newer versions soon, as 12 is a rather old one at this point. I'm curious to know what changed in 16 that |
I think the issue is that in Node 16 the headers are on the prototype and in Node 12 they're on the instance. When a node interceptor clones a message, it only clones the object instance values and not the prototype values. https://github.com/nodejs/node/blob/v12.x/lib/_http_incoming.js#L61 |
Yeap, @trevoro, that's the case. I like your initiative to update the supported Node.js version. That will include updating how we handle |
🎉 This issue has been resolved in version 0.39.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Environment
Request handlers
Actual request
I'm not making the request, the AWS SDK is. The line that's breaking is this one though:
https://github.com/aws/aws-sdk-js/blob/6cf8513d4012e3bc07330c523cf10f45ce807ff5/lib/event_listeners.js#L412
Current behavior
When I install msw and use interception without providing any handlers, the
headers
object isundefined
. If I add aconsole.log
of theresp.httpResponse
in the AWS SDK code, I get this:Downgrading to MSW@0.36.8 resolves this issue
Expected behavior
I expect the headers to exist. I really expect the entire request to happen without any change when I don't handle the request.
The text was updated successfully, but these errors were encountered: