Skip to content

Commit

Permalink
fix(vite-plugin-nitro): retain event context when fetching API routes (
Browse files Browse the repository at this point in the history
  • Loading branch information
jculvey authored Apr 4, 2024
1 parent cb49e78 commit 68b01fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vite-plugin-nitro/src/lib/runtime/api-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default eventHandler(async (event) => {
// and can render the XML correctly as a static asset
!event.node.req.url?.endsWith('.xml')
) {
return $fetch(reqUrl, { headers: event.node.req.headers });
return $fetch(reqUrl, {
headers: event.node.req.headers,
context: event.context,
});
}

return proxyRequest(event, reqUrl, {
Expand Down

0 comments on commit 68b01fe

Please sign in to comment.