You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending a request with FormData even if the server retrun application/json cypress keeps the response as ArrayBuffer
Desired behavior
It should parse it and have body as json
Test code to reproduce
constproduct={};formData.set('data',newBlob([JSON.stringify(product)],{type: 'application/json'}));cy.request({method: 'POST',url: '/api/products',body: formData,}).then(({ body })=>{console.log(body)})
Cypress Version
10.8.0
Node version
16.13.0
Operating System
Fedora 36
Debug Logs
No response
Other
Workaround
cy.request({
data
}).then(res=>{if(data.bodyinstanceofFormData){res.body=JSON.parse(newTextDecoder().decode(res.body));returnres;}else{returnres;}}).then(({ body })=>{console.log(body)})
The text was updated successfully, but these errors were encountered:
I was able to make a reproduction of this and is does seem to me that we shouldn't behave differently based on the contents of the outgoing request, for the same server response: https://github.com/marktnoonan/formdata-test
nagash77
added
E2E
Issue related to end-to-end testing
Triaged
Issue has been routed to backlog. This is not a commitment to have it prioritized by the team.
and removed
routed-to-e2e
labels
Apr 19, 2023
I've been encountering this for all multipart/form-data tests I've run. This is for two APIs for separate projects, using separate tech on the back-end (Django and Node).
Not only that, this never happens when I've used Postman to test these endpoints. So it must exclusively be a Cypress problem.
Unfortunately I can't write complete tests because of this issue, so hopefully it gets fixed (it's been a long time since this was reported).
Current behavior
When sending a request with FormData even if the server retrun
application/json
cypress keeps the response as ArrayBufferDesired behavior
It should parse it and have body as json
Test code to reproduce
Cypress Version
10.8.0
Node version
16.13.0
Operating System
Fedora 36
Debug Logs
No response
Other
Workaround
The text was updated successfully, but these errors were encountered: