fix(orpc): add Next.js server-side headers support (#550)

This commit is contained in:
Igor Belogurov
2025-08-28 18:44:19 +02:00
committed by GitHub
parent 77b3b72b14
commit 8d48ae0359

View File

@@ -33,6 +33,16 @@ export const link = new RPCLink({
credentials: "include", credentials: "include",
}); });
}, },
{{#if (includes frontend "next")}}
headers: async () => {
if (typeof window !== "undefined") {
return {}
}
const { headers } = await import("next/headers")
return Object.fromEntries(await headers())
},
{{/if}}
{{/if}} {{/if}}
}); });