/Knowledge/sources/honojs__hono/llms-full/validation-manual-validator--part-05--de9bc2ba2455.md
Validation: Manual validator (part 05) - hono-docs
Validation: Manual validator (part 05) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt manual validato...
Validation: Manual validator (part 05)
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#manual-validator
Summary
## Content
```ts
// ❌ this will not work
app.post(
'/api',
validator('header', (value, c) => {
// idempotencyKey is always undefined
// so this middleware always return 400 as not expected
const idempotencyKey = value['Idempotency-Key']
if (idempotencyKey == undefined || idempotencyKey === '') {
throw new HTTPException(400, {
message: 'Idempotency-Key is required',
})
}
return { idempotencyKey }
}),
(c) => {
const { idempotencyKey } = c.req.valid('header')
// ...
}
)
// ✅ this will work
app.post(
'/api',
validator('header', (value, c) => {
// can retrieve the value of the header as expected
const idempotencyKey = value['idempotency-key']
if (idempotencyKey == undefined || idempotencyKey === '') {
throw new HTTPException(400, {
message: 'Idempotency-Key is required',
})
}
return { idempotencyKey }
}),
(c) => {
const { idempotencyKey } = c.req.valid('header')
// ...
}
)
Metadata
{
"chunk_index": 4,
"citation": "https://hono.dev/llms-full.txt#manual-validator",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Validation > Manual validator (5)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 101,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Validation: Manual validator (part 05)",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}