-
-
Notifications
You must be signed in to change notification settings - Fork 535
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(setupWorker): emit the correct life-cycle events for bypassed requests #2094
Conversation
kettanaito
commented
Mar 16, 2024
•
edited
Loading
edited
- Fixes Browser: Cannot read properties of undefined (reading 'url') #2053
- Fixes Cannot read properties of undefined (reading 'url') #2083
- Closes fix: add guard for missing context requests #2054
- Depends on fix(bypass): support modifying the bypassed request #2093
Added a failing test for the bypass scenario. Also added a missing test for the passthrough scenario (that one is passing). |
@@ -206,13 +206,6 @@ async function getResponse(event, client, requestId) { | |||
return passthrough() | |||
} | |||
|
|||
// Bypass requests with the explicit bypass header. | |||
// Such requests can be issued by "ctx.fetch()". | |||
const mswIntention = request.headers.get('x-msw-intention') |
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.
Both bypassed and passthrough requests must emit the REQUEST
event to the client so the client (worker context) stores that request in memory. Then, it can find the request instance based on the requestId
when receiving the RESPONSE
event, which right now both mocked and bypassed responses do send correctly.
Released: v2.2.6 🎉This has been released in v2.2.6! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Hey @kettanaito, Did you mean to leave the following line: in After upgrading, the logs seem to be spamming the console and I can't seem to be able to disable them. |
There is an issue #2098 for added |