diff --git a/docs/content/1.get-started/3.tips/5.headers.md b/docs/content/1.get-started/3.tips/5.headers.md index 81c05a3..46b155e 100644 --- a/docs/content/1.get-started/3.tips/5.headers.md +++ b/docs/content/1.get-started/3.tips/5.headers.md @@ -4,7 +4,7 @@ title: Headers # Headers -We can use the built-in `useRequestHeaders` to access/pass headers to any future internal requests during SSR. +We can use the built-in `useRequestHeaders` to set outgoing request headers: ```ts [plugins/client.ts] export default defineNuxtPlugin(() => { @@ -13,8 +13,12 @@ export default defineNuxtPlugin(() => { const client = createTRPCProxyClient({ links: [ httpBatchLink({ + // headers need to be a function so it gets called dynamically + // every HTTP request headers() { - return headers + return { + ...headers + } } }), ],