/Knowledge/sources/honojs__hono/llms-full/honorequest-header--53e34c6f7e7d.md
HonoRequest: header() - hono-docs
HonoRequest: header() Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt header Summary Get the request h...
HonoRequest: header()
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#header
Summary
Get the request header value. ts twoslash import { Hono } from 'hono' const app = new Hono() // ---cut--- app.get('/', (c) => { const userAgent = c.req.header('User-Agent') // ^? return c.text(`Your user agent is ${userAgent}`) }) ...
Content
Get the request header value.
import { Hono } from 'hono'
const app = new Hono()
// ---cut---
app.get('/', (c) => {
const userAgent = c.req.header('User-Agent')
// ^?
return c.text(`Your user agent is ${userAgent}`)
})
::: warning
When c.req.header() is called with no arguments, all keys in the returned record are lowercase.
If you want to get the value of a header with an uppercase name,
use c.req.header(“X-Foo”).
// ❌ Will not work
const headerRecord = c.req.header()
const foo = headerRecord['X-Foo']
// ✅ Will work
const foo = c.req.header('X-Foo')
:::
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#header",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / HonoRequest > header()",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 573,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "HonoRequest: header()",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}