Skip to content

Commit

Permalink
an even better fix for solidjs#1165
Browse files Browse the repository at this point in the history
  • Loading branch information
edivados committed Jan 8, 2024
1 parent e1df5b5 commit 4c42341
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/start/server/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
defineMiddleware,
EventHandlerRequest,
getRequestIP,
getRequestURL,
H3Event,
sendWebResponse,
toWebRequest
Expand All @@ -18,9 +19,13 @@ const eventTraps = {
};

export function createFetchEvent(event: H3Event<EventHandlerRequest>): FetchEvent {
event.web ??= event.web = event.web || {
url: getRequestURL(event),
request: toWebRequest(event)
};
return new Proxy(
{
request: toWebRequest(event),
request: event.web.request,
clientAddress: getRequestIP(event),
locals: {},
// @ts-ignore
Expand Down

0 comments on commit 4c42341

Please sign in to comment.