/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-request-and-respons-0be913dc4750-request-and-response-s0098-c0004.md
Request and Response (5) - hono-docs
Request and Response (5) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt request and response Sum...
Request and Response (5)
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#request-and-response
Summary
You can also pass an instance of the Request class. ```ts test('POST /posts', async () => { const req = new Request('http://localhost/posts', { method: 'POST', }) const res = await app.request(req) expect(res.status).toBe(201) expect(res...
Content
You can also pass an instance of the Request class.
test('POST /posts', async () => {
const req = new Request('http://localhost/posts', {
method: 'POST',
})
const res = await app.request(req)
expect(res.status).toBe(201)
expect(res.headers.get('X-Custom')).toBe('Thank you')
expect(await res.json()).toEqual({
message: 'Created',
})
})In this way, you can test it as like an End-to-End.