Request body

Read the intercepted request's body.

You can read the intercepted request’s body as you normally would any Fetch API Request. The request object you get in the response resolver argument is literally a regular Request instance and can be operated as such.

For example, you can call await request.json() to read the request’s body as JSON:

http.post<{ id: string }, Post>('/posts/:id', async ({ request }) => {
  const newPost = await request.clone().json() // Post
})

The same is true for the other methods like .text(), .formData(), .blob(), etc.