Supertest is not setting headers. Here is the code:
it('should fail getting all users, reason role = user', async () => {
const data = await request(app)
.get('/user/all')
.set('Authorization', token)
.expect(({ header, headers }) => {
console.log('--------------------');
console.log(headers);
console.log('--------------------');
})
.expect(HttpStatus.BAD_REQUEST);
});
Tried with:
.set({
Authorization: token
})
as well not added.
Actual: Authorization header is missing
Expected: Authorization header to be part of the headers body
Aucun commentaire:
Enregistrer un commentaire