fix(cloudflare, lambda): preserve query parameters in url (#155)

This commit is contained in:
Alexander Lichter 2021-03-10 11:25:05 +01:00 committed by GitHub
parent fdc0ffef8d
commit 8cc836ebf6
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ async function handleEvent (event) {
const r = await localCall({ const r = await localCall({
event, event,
url: url.pathname, url: url.pathname + url.search,
host: url.hostname, host: url.hostname,
protocol: url.protocol, protocol: url.protocol,
headers: event.request.headers, headers: event.request.headers,

View File

@ -1,10 +1,11 @@
import '~polyfill' import '~polyfill'
import { withQuery } from 'ufo'
import { localCall } from '../server' import { localCall } from '../server'
export async function handler (event, context) { export async function handler (event, context) {
const r = await localCall({ const r = await localCall({
event, event,
url: event.path, url: withQuery(event.path, event.queryStringParameters),
context, context,
headers: event.headers, headers: event.headers,
method: event.httpMethod, method: event.httpMethod,