cy.visit(url) does not send Accept-Language header.
See original GitHub issueCurrent behavior:
Accept-Language
is not sent to server when using visit()
;. Websites which are expecting to execute based on the Accept-Language
, can not integrate cypress. It is a default header any web browser.
Desired behavior:
Accept-Language
header should be available when using cy.visit(url)
Steps to reproduce:
-
Create a server
instance/page
with a back-end code to listen toHTTP_ACCEPT_LANGUAGE
, E:g$_SERVER['HTTP_ACCEPT_LANGUAGE']
-
Try to access that page using
cy.visit(url)
-
You will see the error since the Cypress does not send Accept-Language to server.
Versions
Cypress = 1.1.2 operating system = Windows 10 browser = Google Chrome
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
visit - Cypress Documentation
An object that maps HTTP header names to values to be sent along with the request. Note: headers will only be sent for...
Read more >How to set the browser's language in Cypress.io (electron ...
from Gleb Bahmutov: you set it during cy.visit using onBeforeLoad with something like Object.defineProperty(navigator, 'language', { value: ...
Read more >cypress-io/cypress - Gitter
I am trying to spin up my first ever test with Cypress and I am kinda bummed at not being able to get...
Read more >Accept-Language - HTTP - MDN Web Docs
This header serves as a hint when the server cannot determine the target content language otherwise (for example, use a specific URL that ......
Read more >Accept-Language - HTTP
The Accept-Language request HTTP header advertises which languages the ... If the server cannot serve any matching language, it can theoretically send back ......
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
@andrew-codes pls do that 😃 a lot of people has their own edge/odd cases where headers needed!
Does it make sense to enable
cy.visit
to accept an options object with headers? Although this would fix it similar to how request does, it seems kind of strange to me; something I’d expect the browser to send along. I’ll investigate a little further.