Skip to content

Commit 14dc44c

Browse files
fix: add guard against query param handling (#272)
1 parent 6c2474b commit 14dc44c

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

packages/dev/src/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ describe('Handling requests', () => {
265265
`export default async () => new Response("Hello from function"); export const config = { path: "/hello" };`,
266266
)
267267
const directory = await fixture.create()
268-
const req = new Request('https://site.netlify/hello')
268+
const req = new Request('https://site.netlify/hello?param1=value1')
269269
const dev = new NetlifyDev({
270270
projectRoot: directory,
271271
})

packages/functions/dev/main.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('Functions with the v2 API syntax', () => {
2323
events.handleEvent(event)
2424
},
2525
destPath,
26+
geolocation: {},
2627
projectRoot: directory,
2728
settings: {},
2829
timeouts: {},
@@ -86,6 +87,7 @@ describe('Functions with the v2 API syntax', () => {
8687
accountId: 'account-123',
8788
config: {},
8889
destPath,
90+
geolocation: {},
8991
projectRoot: directory,
9092
settings: {},
9193
timeouts: {},
@@ -132,6 +134,7 @@ describe('Functions with the v2 API syntax', () => {
132134
events.handleEvent(event)
133135
},
134136
destPath,
137+
geolocation: {},
135138
projectRoot: directory,
136139
settings: {},
137140
timeouts: {},

packages/functions/dev/runtimes/nodejs/lambda.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const lambdaEventFromWebRequest = async (request: Request, route?: string
3636

3737
url.searchParams.forEach((value, key) => {
3838
queryStringParameters[key] = queryStringParameters[key] ? `${queryStringParameters[key]},${value}` : value
39-
multiValueQueryStringParameters[key] = [...multiValueQueryStringParameters[key], value]
39+
multiValueQueryStringParameters[key] = [...(multiValueQueryStringParameters[key] ?? []), value]
4040
})
4141

4242
const { headers, multiValueHeaders } = headersObjectFromWebHeaders(request.headers)

0 commit comments

Comments
 (0)