Open
Description
Current behavior
I'm trying to delete item with:
cy.request({
method: 'DELETE',
url: `http://localhost:8000/api/items/${itemId}`,
followRedirect: false,
auth: {
'bearer': 'long token'
},
}).then(
(response) => {
expect(response.status).to.eq(204);
}
)
My server returns a response with 204 status and an empty body (as defined here https://developer.mozilla.org/fr/docs/Web/HTTP/Status/204).
But I get an error from cypress:
When I change server return with a non-empty body (like "foo"), the test passed.
Desired behavior
Cypress should accept empty response on 204
Test code to reproduce
cy.request({
method: 'DELETE',
url: `http://localhost:8000/api/items/${itemId}`,
followRedirect: false,
auth: {
'bearer': 'long token'
},
}).then(
(response) => {
expect(response.status).to.eq(204);
}
)
Cypress Version
12.17.3
Node version
v20.5.0
Operating System
Archlinux
Debug Logs
cy.request() failed trying to load:
http://localhost:8000/api/items/582
We attempted to make an http request to this URL but the request failed without a response.
We received this error at the network level:
> Error: Parse Error: Expected HTTP/
-----------------------------------------------------------
The request we sent was:
Method: DELETE
URL: http://localhost:8000/api/items/582
-----------------------------------------------------------
Common situations why this would fail:
- you don't have internet access
- you forgot to run / boot your web server
- your web server isn't accessible
- you have weird network configuration settings on your computerLearn more
Other
No response