Transparent handler ("*") doesn't allow fall-through
See original GitHub issueReproduction step
setupWorker(
rest.get('*', () => console.log('caught')),
rest.get('/user', (req, res, ctx) => res(ctx.json({ firstName: 'John' }))
)
Expected behavior
- Prints out
"caught"
in the console. - Returns
{ firstName: "John" }
as the mocked response.
Current behavior
GET /user
returns 404
(not handled).
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Letting a touch "fall through" | Apple Developer Forums
When dealing with touches in SKNodes, sometimes it would be useful in the touchesBegan method of a node to let a touch "fall...
Read more >noFallthroughCasesInSwitch - explicitly allow fall through
I've enabled the noFallthroughCasesInSwitch option in the tsconfig.json file. That option warned me about an "error", and I want to let the ...
Read more >break and fallthrough - PVS-Studio
I understand that the possibility not to write break, made to pass control further, allows writing elegant algorithms.
Read more >Switch/case as a dispatch table with C-style fall-through
Description: I plan to make a collection of various flavors of case/switch/given and package them up for CPAN as one package, probably named ......
Read more >Attributes in Clang — Clang 16.0.0git documentation
If specified, this attribute allows an advanced developer to tune the ... On x86_64 targets, the callee does not clear the stack, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes 💯 Because the first
/use*
handler matched, but returned no mocked response. So it falls through to the next handler, and/user
matches, returning a mocked response. The end result is both"caught"
printed into the console and the mocked response.No. If the
/user
matches and returns a mocked response, MSW stops iterating down the list of request handlers (current behavior).