-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
fix(ClientRequest): prevent req.write()
callbacks from being called twice on passthrough
#685
Conversation
* if `request.end()` was called within `request.write()`. | ||
* @see https://github.com/mswjs/interceptors/issues/684 | ||
*/ | ||
writeCall[2] = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to go with the replacement approach because it's simpler than introducing an internal symbol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
req.write()
callbacks from being called twice on passthrough
Thanks!
I forgot that |
* if `request.end()` was called within `request.write()`. | ||
* @see https://github.com/mswjs/interceptors/issues/684 | ||
*/ | ||
writeCall[2] = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
Thanks for looking at this one! 🎉 |
Released: v0.37.2 🎉This has been released in v0.37.2! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
FormData
are broken) #684Changes
During the
flushWriteBuffer()
, set the invoked callback on the write args toundefined
so it doesn't get called again (twice) during passthrough of requests that callrequest.end()
within therequest.write()
callback. The issue is only reproducible in that scenario and doesn't happen on sequential write/end calls.