Skip to content
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

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

Closed
piyalcodes opened this Issue Jun 8, 2018 · 7 comments

Comments

5 participants
@piyalcodes
Copy link

piyalcodes commented Jun 8, 2018

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

@andrew-codes

This comment has been minimized.

Copy link

andrew-codes commented Jul 18, 2018

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.

@andrew-codes

This comment has been minimized.

Copy link

andrew-codes commented 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.

@jennifer-shehane

This comment has been minimized.

Copy link
Member

jennifer-shehane commented Jul 19, 2018

@andrew-codes I believe @brian-mann has some opinions on the implementation of this.

I also think this thread may be relevant. #908

@RockChild

This comment has been minimized.

Copy link

RockChild commented Jul 23, 2018

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

@chupa-cabras

This comment has been minimized.

Copy link

chupa-cabras commented Jan 3, 2019

I have the same problem :-(

@cypress-bot

This comment has been minimized.

Copy link

cypress-bot bot commented Feb 27, 2019

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.

@cypress-bot

This comment has been minimized.

Copy link

cypress-bot bot commented Mar 15, 2019

Released in 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.