I have a code where I pick the final url after creating a reservation, then I cut the ID of reservation and I want to put it into post link.
I have something like this:
let reservationURL = page.url()
let slicedURL = reservationURL.split('/')
console.log(slicedURL[slicedURL.length - 3])
let reservation_id = slicedURL[slicedURL.length - 3]
const response = await request.post('https:mywebapi/{reservation_id)}/cancel', {
data: {
reservation_id: { reservation_id },
},
})
expect(response.status()).toBe(200)
I have 404 response status not 200.