/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-set-request-id-11d449df7da5-set-request-id-s0340-c0000.md
Set Request ID - hono-docs
Set Request ID Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt set request id Summary You set a c...
Set Request ID
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#set-request-id
Summary
You set a custom request ID in the header (default: X-Request-Id), the middleware will use that value instead of generating a new one: ``ts const app = new Hono() app.use('*', requestId()) app.get('/', (c) => { return c.text(${c.get(...
Content
You set a custom request ID in the header (default: X-Request-Id), the middleware will use that value instead of generating a new one:
const app = new Hono()
app.use('*', requestId())
app.get('/', (c) => {
return c.text(`${c.get('requestId')}`)
})
const res = await app.request('/', {
headers: {
'X-Request-Id': 'your-custom-id',
},
})
console.log(await res.text()) // your-custom-idIf you want to disable this feature, set headerName option to an empty string.