From 277c2060a04a81ad23d47534b48f88ad10c9b6dd Mon Sep 17 00:00:00 2001 From: Teddy Sterne Date: Fri, 13 Dec 2024 12:21:33 -0500 Subject: [PATCH] fix: Don't duplicate Lambda Event Params --- src/adapters/helpers/lambdaEvent.ts | 6 ++++-- test/lambda-event.test.ts | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/adapters/helpers/lambdaEvent.ts b/src/adapters/helpers/lambdaEvent.ts index c973567..24e27f7 100644 --- a/src/adapters/helpers/lambdaEvent.ts +++ b/src/adapters/helpers/lambdaEvent.ts @@ -21,8 +21,10 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => { if (hasMultiValueParams) { Object.entries(params).forEach(([key, value]) => { multiValueParams = multiValueParams || {}; - multiValueParams[key] = Array.isArray(value) ? value : [value]; - params[key] = Array.isArray(value) ? value.join(',') : value; + if (Array.isArray(value)) { + multiValueParams[key] = value; + delete params[key]; + } }); } diff --git a/test/lambda-event.test.ts b/test/lambda-event.test.ts index 658d706..bbf9431 100644 --- a/test/lambda-event.test.ts +++ b/test/lambda-event.test.ts @@ -31,7 +31,6 @@ test('Can parse URLs with duplicate parameters', () => { httpMethod: 'GET', path: '/lifeomic/dstu3/Questionnaire', queryStringParameters: { - _tag: 'http://lifeomic.com/fhir/questionnaire-type|survey-form,http://lifeomic.com/fhir/dataset|0bb18fef-4e2d-4b91-a623-09527265a8b3,http://lifeomic.com/fhir/primary|0343bfcf-4e2d-4b91-a623-095272783bf3', pageSize: '25', }, multiValueQueryStringParameters: { @@ -40,7 +39,6 @@ test('Can parse URLs with duplicate parameters', () => { 'http://lifeomic.com/fhir/dataset|0bb18fef-4e2d-4b91-a623-09527265a8b3', 'http://lifeomic.com/fhir/primary|0343bfcf-4e2d-4b91-a623-095272783bf3', ], - pageSize: ['25'], }, })); assertRequestId(result);