H3 · H30011

Return the response an H3 v2 helper builds

Flags H3 v2 response helpers such as redirect(), html(), and noContent() whose result is never returned from the handler.
H30011vite-doctor/h3responseerrorSuggestion

Run this rule

pnpm vite-doctor . --rules h3/response/no-discarded-response

Why it matters

In H3 v2 these helpers only build a response value. A call whose result is dropped sends nothing, so the handler falls through and responds with whatever it returns next.

Return the helper's result from the handler, such as return redirect("/login").

Example

Return the redirect

Before

export default defineHandler((event) => {
  if (!event.context.user) redirect("/login")
  return "dashboard"
})

After

export default defineHandler((event) => {
  if (!event.context.user) return redirect("/login")
  return "dashboard"
})
Copyright © 2026