Skip to content

Commit

Permalink
bun-lambda: fix http v2 event query parsing (#16684)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba authored Jan 24, 2025
1 parent 0d53353 commit 8f821b7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/bun-lambda/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,17 +364,15 @@ function formatHttpEventV2(event: HttpEventV2): Request {
headers.append(name, value);
}
}
for (const [name, values] of Object.entries(event.queryStringParameters ?? {})) {
for (const value of values.split(",")) {
headers.append(name, value);
}
}
for (const cookie of event.cookies ?? []) {
headers.append("Set-Cookie", cookie);
}
const hostname = headers.get("Host") ?? request.domainName;
const proto = headers.get("X-Forwarded-Proto") ?? "http";
const url = new URL(request.http.path, `${proto}://${hostname}/`);
for (const [name, values] of Object.entries(event.queryStringParameters ?? {})) {
url.searchParams.append(name, values);
}
return new Request(url.toString(), {
method: request.http.method,
headers,
Expand Down

0 comments on commit 8f821b7

Please sign in to comment.