/Knowledge/sources/honojs__hono/llms-full/testing-request-and-response--part-03--6be68a7f069c.md
Testing: Request and Response (part 03) - hono-docs
Testing: Request and Response (part 03) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt request and re...
Testing: Request and Response (part 03)
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#request-and-response
Summary
To make a request to POST /posts with JSON data, do the following. ```ts test('POST /posts', async () => { const res = await app.request('/posts', { method: 'POST', body: JSON.stringify({ message: 'hello hono' }), headers: new Header...
Content
To make a request to POST /posts with JSON data, do the following.
test('POST /posts', async () => {
const res = await app.request('/posts', {
method: 'POST',
body: JSON.stringify({ message: 'hello hono' }),
headers: new Headers({ 'Content-Type': 'application/json' }),
})
expect(res.status).toBe(201)
expect(res.headers.get('X-Custom')).toBe('Thank you')
expect(await res.json()).toEqual({
message: 'Created',
})
})
To make a request to POST /posts with multipart/form-data data, do the following.
Metadata
{
"chunk_index": 2,
"citation": "https://hono.dev/llms-full.txt#request-and-response",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Testing > Request and Response (3)",
"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 (part 03)",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}