Open nerrante opened 1 year ago
So I have found it's not even about the hiding the credentials in the body but actually it can not replace the Variables. I have the same issue with sending in a File Name as a variable. It can not replace the variable names in the body. Which seems a miss.
Cypress.Commands.add('formRequest', (fileName) => {
cy.fixture(fileName, 'binary')
.then( file => Cypress.Blob.binaryStringToBlob(file))
.then(blob =>{
const formData = new FormData();
formData.append("file", blob, fileName);
const httpOptions = {
method: 'POST',
url: `${Cypress.env('apiUrl')}/templates`,
headers: {
'Authorization': Cypress.env('authToken'),
"content-type": "multipart/form-data",
},
body: formData,
failOnStatusCode: false,
};
cy.api(httpOptions).then(response => {
const dec = new TextDecoder()
response.body = dec.decode(response.body)
expect(response.status).to.equal(400);
return response;
})
})
})
Hi Filip, I'm getting a TypeError when trying to hide credentials in the body of the api request. I am running v2.11.1 Let me know if you need anything else!
Here's how my env vars are set:
Here's the call that is failing (with some private stuff taken out):
Here's the error I'm getting: e.requestBody.body[g].replace is not a function