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

Route returning 204 (No content) can't be waited for with route2 #8999

Closed
jraoult opened this issue Oct 28, 2020 · 3 comments · Fixed by #9097
Closed

Route returning 204 (No content) can't be waited for with route2 #8999

jraoult opened this issue Oct 28, 2020 · 3 comments · Fixed by #9097
Assignees

Comments

@jraoult
Copy link

jraoult commented Oct 28, 2020

Current behavior

I'm trying to wait for this route:

 cy.route2({
  method: "DELETE"
}).as("delete");

My server returns a response with 204 status (a valid code for delete cf.https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE). I can see the route is intercepted thanks to the route section in the runner but wait for this route alias always times out.

If I change the server to return a 200 (even without a body) then the wait command passes. Interestingly, in the runner's panel, the request still shows a progress bar even after the wait passes:

with a 204 status:
204

with a 200:
200

I found a workaround by adding a route handler like this:

(req) => {
  req.reply(() => {});
  }

Desired behavior

204 should get the same behaviour as 200

Test code to reproduce

 cy.route2({
  method: "DELETE"
}).as("delete");

// trigger the delete somehow

cy.wait("@delete");

Versions

Cypress 5.5.0

@jraoult jraoult changed the title Route returning 204 (No content) can't be waited for Route returning 204 (No content) can't be waited for with route2 Oct 28, 2020
@flotwig
Copy link
Member

flotwig commented Nov 4, 2020

This seems to happen with any empty body status code, like 304 Found, has the same behavior.

@cypress-bot cypress-bot bot added the stage: work in progress There is an open PR for this issue [WIP] label Nov 4, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: ready for work The issue is reproducible and in scope and removed stage: work in progress There is an open PR for this issue [WIP] stage: needs review The PR code is done & tested, needs review labels Nov 5, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: ready for work The issue is reproducible and in scope labels Dec 1, 2020
@cypress-bot cypress-bot bot added stage: pending release There is a closed PR for this issue and removed stage: needs review The PR code is done & tested, needs review labels Dec 2, 2020
@cypress-bot
Copy link

cypress-bot bot commented Dec 2, 2020

The code for this is done in cypress-io/cypress#9097, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link

cypress-bot bot commented Dec 7, 2020

Released in 6.1.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v6.1.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: pending release There is a closed PR for this issue label Dec 7, 2020
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants