Skip to content

Commit

Permalink
fix: pass headersOriginal in pageContext
Browse files Browse the repository at this point in the history
  • Loading branch information
nitedani committed Jul 31, 2024
1 parent 8525c45 commit 70b16ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vike-node/src/runtime/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function createHandler<PlatformRequest>(options: VikeOptions<PlatformRequ
): Promise<boolean> {
const pageContext = await renderPage({
urlOriginal: req.url ?? '',
userAgent: req.headers['user-agent'],
headersOriginal: req.headers,
...(await getPageContext(platformRequest))
})

Expand All @@ -106,7 +106,9 @@ export function createHandler<PlatformRequest>(options: VikeOptions<PlatformRequ
}

function getPageContext(platformRequest: PlatformRequest) {
return typeof options.pageContext === 'function' ? options.pageContext(platformRequest) : options.pageContext ?? {}
return typeof options.pageContext === 'function'
? options.pageContext(platformRequest)
: (options.pageContext ?? {})
}
}

Expand Down

0 comments on commit 70b16ce

Please sign in to comment.