Parse Error on DELETE request
See original GitHub issueCurrent behavior:
My page send a DELETE
request with a json body to the server that correctly respond with status 204 and empty body (I verified it both on server logs and using wireshark
)
cypress instead show a 500 status in the command log and if I print the response body with
cy.wait('@deleteApn').then(xhr => {
cy.exec(`echo ${JSON.stringify(xhr.response.body)} > aaa.json`)
})
I get
<!DOCTYPE html>
<html>
<body>
Cypress errored attempting to make an http request to this url:
http://172.17.102.170:3000/nc/api/apn/
The error was:
Parse Error
The stack trace was:
Error: Parse Error
at Socket.socketOnData (_http_client.js:454:20)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:252:12)
at readableAddChunk (_stream_readable.js:239:11)
at Socket.Readable.push (_stream_readable.js:197:10)
at TCP.onread (net.js:589:20)
</body>
</html>
- Operating System: Debian 9 virtual machine
- Cypress Version: 2.0.4
- Browser Version: electron 59
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Why the delete method giving me unexpected token < in ...
post looks for a POST request but you are making a DELETE request; id is being converted to [object%20Object] so it is an...
Read more >DELETE - HTTP - MDN Web Docs
The HTTP DELETE request method deletes the specified resource.
Read more >Send a curl DELETE Request {With Example} - phoenixNAP
The HTTP DELETE method request sends a signal to the originating server to delete a resource. This tutorial explains how to send a...
Read more >RFC 7231: Hypertext Transfer Protocol (HTTP/1.1)
DELETE The DELETE method requests that the origin server remove the ... complete the request o 4xx (Client Error): The request contains bad...
Read more >Delete row method returning a parsing error when it ...
Hello, This method was not giving me any issues prior to today. I'm using hte c# sdk. code:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is likely a bug in Cypress but it’s likely your server doing something funky to cause it.
My guess is that your server is sending back something like:
Content-Type: application/json
but then sending an empty response body (which is invalid). Cypress should probably handle this instead of dying - but we need to be able to reproduce this in order to fix it.Can you send us the response exactly from your server - including headers and body. You could export as HAR. Even sending what it looks like when you work outside of Cypress would be enough for us to mimic and likely reproduce.
If what I suspect is the problem it will be easy to fix and we can get a patch out.
Released in
3.3.0
.