silverwolf-x's picture
download
raw
654 Bytes
import { headers } from 'next/headers'
export default async function Page() {
return (
<>
<p>
This page accesses headers synchronously. This triggers a type error. In
dev mode, we also log an explicit error that `headers()` should be
awaited.
</p>
<HeadersReadingComponent />
</>
)
}
async function HeadersReadingComponent() {
// Cast to any as we removed UnsafeUnwrapped types, but still need to test with the sync access
const userAgent = (headers() as any).get('user-agent')
return (
<div>
this component reads the `user-agent` header synchronously: {userAgent}
</div>
)
}

Xet Storage Details

Size:
654 Bytes
·
Xet hash:
260e4f04fcc70911be14161e9edd448c2544361e92e642aae63401d7ba90041a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.