/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-request-4220e0bb9436-request-s0622-c0000.md
request() - hono-docs
request() Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt request Summary request is a useful met...
request()
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#request
Summary
request is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ```ts twoslash import { Hono } from 'hono' const app = new Hono() declare const test: (name: string, f...
Content
request is a useful method for testing.
You can pass a URL or pathname to send a GET request.
app will return a Response object.
import { Hono } from 'hono'
const app = new Hono()
declare const test: (name: string, fn: () => void) => void
declare const expect: (value: any) => any
// ---cut---
test('GET /hello is ok', async () => {
const res = await app.request('/hello')
expect(res.status).toBe(200)
})You can also pass a Request object:
import { Hono } from 'hono'
const app = new Hono()
declare const test: (name: string, fn: () => void) => void
declare const expect: (value: any) => any
// ---cut---
test('POST /message is ok', async () => {
const req = new Request('Hello!', {
method: 'POST',
})
const res = await app.request(req)
expect(res.status).toBe(201)
})