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
Cypress removes custom status text/reason phrase from http response #16973
Comments
Same issue with Cypress 7.5.0 |
It's happening because Cypress normalizes the cypress/packages/server/lib/request.js Lines 499 to 505 in 8550842
It's been added at 4/21/2017 by @chrisbreiding (23209b2). It's not hard to fix this but I'm not sure it's OK to do so. |
Up, Im needing this, or at least an option to trigger if yes or no I want my custom header message |
I think this would be fine to open a PR for if someone wants to fix this. I don't think we should be messing with the |
I found a work around for this issue which allows defining a custom statusText and statusCode simultaneously by first stubbing the response with a staticResponse and then modifying that response with a routeHandler: cy.intercept("PUT", "/url", { statusCode:422 });
cy.intercept("PUT", "/url", (req) => {
req.on("before:response", (res) => {
res.statusMessage = "ConcurrentLiveEvent";
res.send();
});
}); This also works using |
I would like to take this up and drill down more into it. Kindly let me know whether the approach proposed by @Jeje2201 can be taken forward? |
@kshastri Yes, please feel welcome to open a PR and tag me if you need help or a review. The solution that I would like to see implemented would involve our proxy not manipulating the "reason phrase" at all. The proxy should transparently proxy the reason phrase - if the server sends an empty phrase, we should proxy an empty phrase, if the server sends "200 foo", we should proxy "200 foo". I think you'll most likely be able to make this happen inside of
I don't think we need an option, this behavior is pretty universally undesirable from a proxy. |
The code for this is done in cypress-io/cypress#22061, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
Server responds with a http 400 with the text "Åtgärden kan inte vara utförd innan bristen upptäcktes."
generated by the code
var resp = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(""), ReasonPhrase = "Åtgärden kan inte vara utförd innan bristen upptäcktes." };
in C# for .NET 4.8
Cypress then strips that text and returns http.STATUS_CODES[400]
shows up in Chromiums network tab as:
The only other resource I found about this issue was this:
https://stackoverflow.com/questions/63050722/cypress-not-receiving-custom-status-text
Desired behavior
The status text /reason phrase should be forwarded as is to the client.
running outside of Cypress, Chromium shows this
Versions
Running Cypress 5.6.0. Unable to upgrade to 6+ due to #14447
Chromium Version 90.0.4427.0
Windows 10 Enterprise 2004
Cypress-ntlm-auth 3.2.2-beta.1 (bjowes/cypress-ntlm-auth#175)
The text was updated successfully, but these errors were encountered: