/Knowledge/sources/honojs__hono/llms-full/testing-request-and-response--dce2fa17a42f.md
Testing: Request and Response - hono-docs
Testing: Request and Response Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt request and response Sum...
Testing: Request and Response
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#request-and-response
Summary
All you need to do is create a Request and pass it to the Hono application to validate the Response. You can then use the useful app.request method. ::: tip For a typed test client see the testing helper. ::: F...
Content
All you need to do is create a Request and pass it to the Hono application to validate the Response. You can then use the useful app.request method.
::: tip For a typed test client see the testing helper. :::
For example, consider an application that provides the following REST API.
app.get('/posts', (c) => {
return c.text('Many posts')
})
app.post('/posts', (c) => {
return c.json(
{
message: 'Created',
},
201,
{
'X-Custom': 'Thank you',
}
)
})
Make a request to GET /posts and test the response.
describe('Example', () => {
test('GET /posts', async () => {
const res = await app.request('/posts')
expect(res.status).toBe(200)
expect(await res.text()).toBe('Many posts')
})
})
To make a request to POST /posts, do the following.
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#request-and-response",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Testing > Request and Response (1)",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 98,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Testing: Request and Response",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}