Sending blob as body of a request sends empty content:
const body = new Blob([[1, 2, 3, 4]], { type: "application/octet-stream" });
cy.request(
{
body,
method: "POST",
url: "api/binaryBody",
headers: {
"Content-Type": "application/octet-stream",
}
})
.then(response => {
expect(response.status).to.equal(200);
});
Results in following request:
The request we sent was:
Method: POST
URL: https://localhost:5001/api/binaryBody
Headers: {
"Connection": "keep-alive",
"Content-Type": "application/octet-stream",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"content-length": 2
}
Body: {}
Expected behavior:
Binary data from the blob should be sent as the request body and the content-length header should be set correctly
Versions
Cypress: 3.8.2
OS: Windows 10 v1809, 64-bit
Browser: Chrome 76.0.3809.132
Node.js: 12.13.0
Sending blob as body of a request sends empty content:
Results in following request:
Expected behavior:
Binary data from the blob should be sent as the request body and the
content-lengthheader should be set correctlyVersions
Cypress: 3.8.2
OS: Windows 10 v1809, 64-bit
Browser: Chrome 76.0.3809.132
Node.js: 12.13.0