Can't get a POST API call to work from Cypress #25858
Unanswered
anufrancis
asked this question in
Questions and Help
Replies: 1 comment
-
Usually the username and password go inside the body
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there anything wrong with this script? I am new to cypress and trying to make a POST API call from my spec file. The same API works outside using POSTMAN, but using Cypress I get 415 not supported error at cy.request.
cy.request({
method: 'POST',
url: 'https://test-apipostcall/rest/ng/query',
auth: {
username: '[email protected]',
password: '#######',
},
body: {
"cpId": 709916,
"aql": "select Specimen.label, Specimen.availableQty, Specimen.specimenPosition.containerName,Specimen.activityStatus where Specimen.id=10884195"
},
}).then(res => {
expect(rows[0]).to.eq('fulldisspecimen');
});
Beta Was this translation helpful? Give feedback.
All reactions