/Knowledge/sources/honojs__hono/llms-full/validation-manual-validator--part-02--c2a51d2ddbac.md

Validation: Manual validator (part 02) - hono-docs

Validation: Manual validator (part 02) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt manual validato...

Validation: Manual validator (part 02)

Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#manual-validator

Summary

Validation targets include json, query, header, param and cookie in addition to form. ::: warning When you validate json or form, the request must contain a matching content-type header (e.g. `Content-Type: applicatio...

Content

Validation targets include json, query, header, param and cookie in addition to form.

::: warning When you validate json or form, the request must contain a matching content-type header (e.g. Content-Type: application/json for json). Otherwise, the request body will not be parsed and you will receive an empty object ({}) as value in the callback.

It is important to set the content-type header when testing using app.request().

Given an application like this.

const app = new Hono()
app.post(
  '/testing',
  validator('json', (value, c) => {
    // pass-through validator
    return value
  }),
  (c) => {
    const body = c.req.valid('json')
    return c.json(body)
  }
)

Your tests can be written like this.

Metadata

{
  "chunk_index": 1,
  "citation": "https://hono.dev/llms-full.txt#manual-validator",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / Validation > Manual validator (2)",
  "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 02)",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/validation-manual-validator--part-02--c2a51d2ddbac.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.