H3 · Responses

H30012Set the status on the Response you return

Flags a status set through event.res.status or setResponseStatus() in a handler that returns a Response.

Why it happens

H3 v2 applies a prepared event.res.status only to plain return values. A returned Response keeps its own status, so the prepared status is silently ignored and the client gets 200.

Fix

Pass the status to the Response, such as new Response(body, { status: 201 }), or return a plain value instead.

Example

Set the status on the Response

Before

export default defineHandler((event) => {
  event.res.status = 201
  return new Response("created")
})

After

export default defineHandler(() => {
  return new Response("created", { status: 201 })
})

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/response/no-prepared-status-with-response
Copyright © 2026