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 does not send headers / change HTTP method when baseUrl contains `:80`

See original GitHub issue

Current behavior:

cy.visit({ url, method, headers }) does not appear to honour the method, or headers

Desired behavior:

cy.visit({ url, method, headers }) should send the specified method and headers.

Steps to reproduce: (app code and test code)

cy.visit({ 
  url: '/ui', 
  method: 'POST',
  headers: {
    'mock-user': JSON.stringify(mockUser)
  }
});

I include an annotated Cypress debug log:

debug-log

Changing the method to GET still results in the headers not being sent

Versions

I tested Cypress 3.4.1 and 3.2.0. Ubuntu LTS Chrome 77

UPDATE: Cause tracked down to: https://github.com/cypress-io/cypress/issues/5367#issuecomment-542329058

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cypress-bot[bot]commented, Nov 8, 2019

Released in 3.6.1.

1reaction
flotwigcommented, Oct 17, 2019

Ugh, that definitely sounds possible. The cy.visits are cached by URL, maybe we’re keeping the default port when storing the response but not when pulling it back out, or vice versa. Thanks for tracking this down, this should be pretty easy to fix now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

visit - Cypress Documentation
Note: headers will only be sent for the initial cy.visit() request, not for any subsequent requests. qs, null, Query parameters to append to...
Read more >
cypress-io/cypress - Gitter
Hi guys! I am trying to spin up my first ever test with Cypress and I am kinda bummed at not being able...
Read more >
Cypress: How to visit a url of a different origin? - Stack Overflow
I have my base URL set to the domain I want to test, the issue is when I want to test the ability...
Read more >
@cypress/request - npm
The HTTP method, headers, and entity-body data will be sent. ... are set, they will be used to proxy non-SSL requests that do...
Read more >
Challenge solutions - Pwning OWASP Juice Shop
Visit http ://localhost:3000/#/basket to solve the challenge. If the challenge is not immediately solved, you might have to F5 -reload to relay the...
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