cy-api
cy-api copied to clipboard
2.1.2 version- errors with the body format. The cause is in the highlight.js file
When the body looks like this : { "forwardTo": " " } , Cypress cy.api returns an error. It works fine with the cy.request and with the previous cy.api version.


I have added a test for this but did not see a problem, can you add a test showing the crash?
Thanks Gleb ! I will take a look on hightlight lib
Can you help us to reproduce @OlgaShchekina ?
Can you help us to reproduce @OlgaShchekina ?
try running this, should be reachable from anywhere, no tokens
it('works with cy.request, fails with cy.api', () => {
cy.api({
url: 'https://api-dev.helloextend.com/claims-assistant/contact',
method: 'POST',
body: {
name: 'cypress test',
phoneNumber: '123-456-7890',
email: `[email protected]`,
requestType: 'productProtection',
locale: 'en-US',
message: 'This is a cypress test',
},
retryOnStatusCodeFailure: true,
})
.its('status')
.should('equal', 200)
})
I'm experiencing a similar issue. My endpoint is returning a no-content 204, with an empty JSON body. As a quick fix, it seems if I just set the body to an empty object when it is undefined on this line, then it passes.