H3 · Request body

H30016Read the request body once

Flags a handler that reads the request body twice, or reads it and then proxies the request.

Why it happens

H3 v2 uses the Web Request stream. If a body is present and the first read consumes it, a second read can fail and the original stream can no longer be forwarded by a proxy.

Fix

Read the body once and reuse it, or read from a clone before forwarding the original stream to a proxy.

Example

Read the body once

Before

export default defineHandler(async (event) => {
  await audit(await readBody(event))
  return save(await readBody(event))
})

After

export default defineHandler(async (event) => {
  const body = await readBody(event)
  await audit(body)
  return save(body)
})

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --rules h3/body/no-double-body-read
Copyright © 2026