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.

Parse Error on DELETE request

See original GitHub issue

Current 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
brian-manncommented, Mar 1, 2018

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.

0reactions
cypress-bot[bot]commented, May 17, 2019

Released in 3.3.0.

Read more comments on GitHub >

github_iconTop 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 >

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