Functions

headers

Async read-only incoming headers. get returns a string or null. Treat supplied header values as untrusted unless separately verified. Source: https://nextjs.org/docs/app/api-reference/functions/headers

Formal Syntax & Structure

nextjs syntaxnextjs
import { headers } from "next/headers"; const h = await headers();

Working Example

Example Snippetnextjs
const accept = (await headers()).get("accept-language");
Next.js Reference