/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-request-and-respons-0be913dc4750-request-and-response-s0098-c0000.md
Request and Response (1) - hono-docs
Request and Response (1) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt request and response Sum...
Request and Response (1)
Source evidence: /Sources/raw/honojshono/honojshono.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.