How to use post method for http call 301
amrsa1 opened this issue · 6 comments
im unable to perform post method for an API that will return 301 once you successfully logged in
here is what i did
`describe ('Backend Validation', function () {
frisby.globalSetup({
request: {
followRedirect: 'follow', // also try it with redirect: false and without anything as well
headers: {
origin: 'example.com',
referer: 'https://example.com/login?redirect=https%3A//exa.com/',
}
}
});
it('1- Verify backend and API will return 301', function () {
return frisby
.post('https://example.com/EAI/Login', {
username: 'my user',
password: 'my pass'
})
.expect('status', 302)
})
});
`
here is also all api details
Sounds like you need {redirect: 'manual'}
: https://stackoverflow.com/questions/42716082/fetch-api-whats-the-use-of-redirect-manual
Sounds like you need
{redirect: 'manual'}
: https://stackoverflow.com/questions/42716082/fetch-api-whats-the-use-of-redirect-manual
same still returning 200 postman returning the expect value 302
describe ('Backend Validation', function () {
frisby.globalSetup({
request: {
redirect: 'manual',
headers: {
origin: 'https://sss.com',
referer: 'https://aaa.com',
}
}
});
it('1- API will retrun 302', function () {
return frisby
.post('https://example.com/EAI/Login', {
username: 'user',
password: 'pass'
})
.expect('status', 302)
})
});
Try using fetch()
instead of post()
and see if that makes a difference. It's a direct pass through to the fetch API.
u mean just replace post with fetch
Yes