fix: support the onUnhandledRequest option#19
Conversation
|
@kettanaito @zachatrocity |
|
I'm with ya @lukebickell ! I think things have slowed for @kettanaito with open source stuff. I'm still willing to actively support this pr I think I'm just kinda blocked waiting for reviews. Unless by chance you know of other maintainers that could review! |
src/index.ts
Outdated
| return | ||
| } else { | ||
| if (onUnhandledRequest) { | ||
| onUnhandledRequest(fetchRequest) |
There was a problem hiding this comment.
I don't believe we need to invoke this manually. If you provide it to worker.start(), MSW will apply it for you. All you need here is a type-safe onUnhandledRequest option in the args.
There was a problem hiding this comment.
@kettanaito I tried removing this but was having issues getting the test to fire the onUnhandledRequest.
Correct me if I'm wrong but it doesn't seem like msw/playwright leverages handleRequest so we never get to the lookup logic in msw/core that executes the onUnhandledRequest
It seems we use the getResponse but to parse and return handler values but rely more on the native playwright page.route to trigger and return requests. It would be nice to let msw invoke onUnhandledRequest so please let me know if I'm missing something
For now I've explicitly invoked it and added a test so we can see how we'd like to proceed.
kettanaito
left a comment
There was a problem hiding this comment.
Thanks for working on this, @zachatrocity. It took me some time to get to this as you've rightfully concluded I'm a bit busy with personal stuff and trying to focus on that as much as I can.
I've reviewed the changes, you can continue with reusing the OnUnhandledRequest-related types from msw now!
|
No worries @kettanaito! Personal stuff always comes first. I'll get this updated Monday! |
src/index.ts
Outdated
| }) | ||
| return | ||
| } else { | ||
| if (typeof onUnhandledRequest === 'function') { |
There was a problem hiding this comment.
This is quite less than ideal, waiting on closure in this thread from @kettanaito for guidance on how to proceed.
onUnhandledRequest option
Released: v0.4.4 🎉This has been released in v0.4.4. Get these changes by running the following command: Predictable release automation by Release. |
This is a PR to add the basic
onUnhandledRequestfunctionality as part of #18Pending this PR: mswjs/msw#2562