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.
Accept-Language header should be available when using cy.visit(url)
1) Create a server instance/page with a back-end code to listen to HTTP_ACCEPT_LANGUAGE,
E:g $_SERVER['HTTP_ACCEPT_LANGUAGE']
2) Try to access that page using cy.visit(url)
3) You will see the error since the Cypress does not send Accept-Language to server.
Cypress = 1.1.2
operating system = Windows 10
browser = Google Chrome
Hi, I am also experiencing this issue. Although I am able to provide the Accept-Language header in a cy.request(), I am unable to do so with cy.visit(). I'd love to submit a PR. I will review the contributing guidelines, etc. tonight, though if there are any things and/or direction on preference for a solution, that would be helpful (so I don't implement a solution that does fit the vision of the API, etc.). Thanks.
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.
@andrew-codes I believe @brian-mann has some opinions on the implementation of this.
I also think this thread may be relevant. https://github.com/cypress-io/cypress/issues/908
@andrew-codes pls do that :) a lot of people has their own edge/odd cases where headers needed!
I have the same problem :-(
The code for this is done in cypress-io/cypress#3489, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Released in 3.2.0.
Most helpful comment
@andrew-codes pls do that :) a lot of people has their own edge/odd cases where headers needed!