question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cy.visit(url) does not send Accept-Language header.

See original GitHub issue

Current 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:

  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.

Versions

Cypress = 1.1.2 operating system = Windows 10 browser = Google Chrome

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
RockChildcommented, Jul 23, 2018

@andrew-codes pls do that 😃 a lot of people has their own edge/odd cases where headers needed!

2reactions
andrew-codescommented, Jul 18, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found