feat: no match return 501 response#2868
Conversation
I agree this is the better approach 👍🏼 |
|
This is an unexpected error case that typically happens (for me) when code has changed and test recordings need to be fixed. So it really depends on "who" is doing the testing here: client or server - in most cases it is going to be both. If it's the client, a 5xx makes perfect sense. If it's the server, a "crash" would work better, however then the client couldn't debug. Returning an explicit 5xx means that we would need to intercept, log and/or throw it on the server. Seems very reasonable, especially since we are already returning a 404 currently. Alternative would be to do a config flag to switch between an explicit 5xx and crash. But I don't see a need for that currently. I'm happy with changing this to a 5xx. Should allow me to get rid of some hacks for node-tdd. tldr; Yes, this looks good 👍 |
|
Thanks to both of you! I'll continue in this direction. @simlu, what do you mean by "who" makes the request? As I see it,
To elaborate on this.. we can separate the request into two parts:
In the first part, |
Some of the use cases that are supported by node-tdd are not exactly the vanilla use cases for nock. I think wrt this ticket, we don't really need to worry about them. What you've written down definitely makes sense and think you're good to continue with this change-set! |
|
🎉 This PR is included in version 15.0.0-beta.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
nock, we simply threw an error, which resulted in unspecified errors. (disableNetConnect() / "Not allow net connect" errors are swallowed up #884, disableNetConnect should return an IncomingMessage #2211)@gr2m Before investing time in adjusting the tests, WDYT about this?
@simlu I'd also love your thoughts here.
Resolves #2558