-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
visit() does not send user agent header as specified #3719
Comments
It's probably because the UA header gets clobbered in two places in https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/request.coffee#L267 From a first glance, it looks like this is just Cypress trying to pass along the UA of the browser with the request. It'd probably be safe to change these lines to have Need to make sure we're normalizing headers to be lowercase before that can happen. |
You can set the There's some explanation on why we implemented it this way here: #364 headers lowercase issue: #2879 We should document this more clearly though within the cy.visit() doc though. |
After further discussion - we should probably also at least handle warning the user when passing a User-Agent header that there is another way to implement this (if not change the implementation to work altogether), so we reopened. |
The code for this is done in cypress-io/cypress#3920, but has yet to be released. |
Released in |
Current behavior:
With the new feature in 3.2.0 that enables setting headers for
visit()
, "user agent" header is not correctly passed to server sideDesired behavior:
user agent header can be passed to server side as specified
Steps to reproduce: (app code and test code)
Using the following code:
And observe server side receives something like this:
As shown above, header "hello" is correctly passed, therefore the header setting is recognized by cypress. However, header "User-Agent" is still my real browser which is the error
Versions
cypress 3.2.0
The text was updated successfully, but these errors were encountered: