4

When I load the page it makes a call to my api https://<apiurl>/products. In cypress this request fails with:

GET https://<apiurl>/products net::ERR_EMPTY_RESPONSE

If I copy the cURL request the response comes back fine. I double checked the headers coming back from the api and there's no cors issue. Nothing is stubbed this is the entire test:

describe('Plans page', () => {
  it('should load', () => {
    cy.visit('http://localhost:8001/plans')
    expect(1).to.eq(1)
  })
})
"cypress": "6.8.0",
azium
  • 20,056
  • 7
  • 57
  • 79
  • 1
    found the answer in this other answer https://stackoverflow.com/questions/58048082/disable-web-security-in-cypress-just-for-one-test – azium Apr 06 '21 at 01:56

1 Answers1

1

In my case the issue was caused by the corporate proxy. I had to add proxy configuration. (I had exactly same error: net::ERR_EMPTY_RESPONSE)

Linux:

export http_proxy=http://...
export https_proxy=http://...
export NO_PROXY=...

cypress open
Felix
  • 3,999
  • 3
  • 42
  • 66