I try to do a GET if a error occurs in a previous POST with supertest. The problem is that I am unable to use GET. This is my code:
bookId = await request(app).post("/books/add-one-book").send({
"name":"bookTest",
"chapters": 1
})
if (bookId === undefined) {
const allBooks = await request(app)
.get("/books/all-books")
.set({
Authorization: `Bearer ${token}`
})
bookId = allBooks;
...
The warning says:
Argument type string is not assignable to parameter type "set-cookie".
The warning for set is:
Unresolved function or method set()
What did I do wrong? I think supertest don't see the right GET... But I have seen a lot of example on the web and all of them use get like this. Do you see something? Thanks.