cypress
cypress copied to clipboard
Response body is dropped for multipart POSTs
Current behavior
I am sending a multipart POST. The request is formed correctly and reaches the server. The response is also sent as expected form the server. But for some reason the response body seems to be dropped. See code below for the exact request.
When doing .debug() after the cy.request() I can see that the body is an ArrayBuffer.
With other POST requests I'm doing this doesn't happen, the response body there appears in the debug information as a JSON.
Test code to reproduce
cy.readFile('cypress/fixtures/dummy.pdf', 'binary')
.then((binary) => Cypress.Blob.binaryStringToBlob(binary))
.then((blob) => {
const formData = new FormData()
formData.append('file', blob, 'dummy.pdf')
formData.append('parent', parentUuid)
cy.request({
method: 'POST',
url: 'http://localhost:8000/api/upload/',
body: formData,
}).then((response) => {
// response.body here is {}, but I am sure the server is sending something else
})
Cypress Version
10.3.1
Node version
19.0.1
Operating System
macOS 13
possibly related to https://github.com/cypress-io/cypress/issues/24560.
@manuhortet I'm sorry you are having difficulties. Can you try the workaround in the above linked ticket and see if that fixes your problem for the short term while we investigate further? Thank you.
Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.