using an old version of MSW (0.36.7, old project), is there a way to have different response with body on the same request?
I have a component that displays multiple images. Each images require an API call, and I want to check that all images are loaded. When they are loaded, the API returns a URL for each and I have to call the images one by one.
What I have is this, and it works for 1 images, but I can’t get it to work for multiple calls and change the body:
server.use(
rest.get(/api/images/:id:, async (req, res, ctx) =>
res(ctx.status(HttpStatusCode.Ok),
// Here I would like to have a different url. On call 2 I would like some_image_id_2
ctx.body(JSON.stringify({ url: 'some_image_id_1' })))
)
);
Please note that this call will be done in 1 test case, so it’s not about resetting the server and defining a new one.
1 test case will call the API multiple times.
Thanks for any help