-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Chrome Cypress browser adds "charset=utf-8" to the content-type in the response header #3650
Comments
I also encountered the same problem. Previously my app checks the Content-Type of the http response by doing a string comparison which fails. I refactored it so it checks the existence of the desired type instead: // wrong
response.headers.get('Content-Type') === 'application/json'
// right
response.headers.get('Content-Type').includes('application/json') I don't think you can always safely assume that browsers will only send 'application/json' in the Content-Type header. Hope that helps. |
@yusinto yeah, that was my solution to this problem as well. |
In my case strange is that, |
This is a symptom of ExpressJS (which Cypress uses for the internal proxy server) forcing |
The code for this is done in cypress-io/cypress#4698, but has yet to be released. |
Released in |
Thank you! |
Current behavior:
Some of my website's HTTP requests are failing only in the Cypress browser (e.g. signing up for a new account). After debugging, it was discovered this was due to the response header returning a different
content-type
in the Cypress browser.Chrome browser:
Cypress browser (not running headlessly):
Cypress is adding
"charset=utf-8"
to thecontent-type
.Desired behavior:
Return the same
content-type
as the Chrome browser.Versions
3.1.5
Chrome 72
The text was updated successfully, but these errors were encountered: