Waits for all tracked request bodies to be parsed and returns the requests.
Use this when you need to access req.body directly. For body assertions, prefer using expectAsync which handles this automatically.
req.body
expectAsync
The tracked server
Promise resolving to tracked requests with bodies parsed
await fetch(url, { method: 'POST', body: JSON.stringify({ name: 'Bob' }),});const requests = await waitForBodies(server);console.log(requests[0].body); // { name: 'Bob' } Copy
await fetch(url, { method: 'POST', body: JSON.stringify({ name: 'Bob' }),});const requests = await waitForBodies(server);console.log(requests[0].body); // { name: 'Bob' }
Waits for all tracked request bodies to be parsed and returns the requests.
Use this when you need to access
req.bodydirectly. For body assertions, prefer usingexpectAsyncwhich handles this automatically.