Nitro · Request
NITRO0005Use readValidatedBody for validated request bodies
When a Nitro handler validates a request body, read and validate it through the H3 utility.
vite-doctor/nitrorequestwarnSuggestion
Why it happens
Raw request input and validation can drift apart when they are separate operations. Nitro and h3 provide validated helpers that keep parsing and validation coupled at the request boundary.
Fix
Use readValidatedBody(event, validator) instead of readBody(event) followed by separate validation.
Example
Keep reading and validation together
Before
export default defineEventHandler(async (event) => {
const input = await readBody(event)
const value = validator.parse(input)
return value
})
After
export default defineEventHandler(async (event) => {
const value = await readValidatedBody(event, validator)
return value
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --framework nitro --rules nitro/request/prefer-validated-body