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
Status 400 (OK) displaying when it should display (Bad Request) #70
Comments
My guess is that since MSW constructs a new One way to solve it for now could be to provide an explicit status text alongside the status code: ctx.status(400, 'Bad request') I value the validity of requests and responses, but I wonder whether it's the library's responsibility to map status codes to texts implicitly. I'd expect this to be done by |
That's fine. Thank you for helping me know what to do there. |
I think that having a default statusText that's the same as what the statusText would be for a given status code would be useful. I could always override it if I want to, but having a default to what the browser does would be sensible IMO. |
I was thinking of keeping a status code-status text map internally in MSW and mapping it by default, as you described. I guess there's little harm in that, but a big gain in developer experience. |
I went with the solution that reuses the Starting from @kentcdodds, could you please update to |
Confirmed. This worked. Thanks! |
Hey, @pandrodo. That's perfectly fine. Can you clarify a few things:
|
@pandrodo, thanks for including that. The issue confirmed as reproducible, the fix pull request is issued. Regression test was added, so we don't miss it occurring again. Will be released in the next minor version of |
@kettanaito, thanks for so fast fix. |
Here's what a request looks like when I set the status to 400 with msw vs a real server sending a 400:
I'm not sure what could be causing this.
The text was updated successfully, but these errors were encountered: