2022-04-06 05:56:08 +00:00
|
|
|
# `useRequestHeaders`
|
2021-12-20 16:27:36 +00:00
|
|
|
|
|
|
|
Nuxt provides composables and utilities for first-class server-side-rendering support.
|
|
|
|
|
|
|
|
Within your pages, components, and plugins you can use `useRequestHeaders` to access the incoming request headers.
|
|
|
|
|
|
|
|
```js
|
|
|
|
// Get all request headers
|
|
|
|
const headers = useRequestHeaders()
|
|
|
|
|
|
|
|
// Get only cookie request header
|
|
|
|
const headers = useRequestHeaders(['cookie'])
|
|
|
|
```
|
|
|
|
|
|
|
|
::alert{icon=👉}
|
2022-04-16 13:53:36 +00:00
|
|
|
In the browser, `useRequestHeaders` will return an empty object.
|
2021-12-20 16:27:36 +00:00
|
|
|
::
|