From c5ef54a06d6a9bd4c692e0339f21161cbfbf1e3f Mon Sep 17 00:00:00 2001 From: Teddy Sterne Date: Mon, 4 Nov 2024 16:03:58 -0500 Subject: [PATCH] Remove array values from queryStringParameters --- src/adapters/helpers/lambdaEvent.ts | 7 +++---- test/lambda-event.test.ts | 7 +------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/adapters/helpers/lambdaEvent.ts b/src/adapters/helpers/lambdaEvent.ts index 257a645..6155942 100644 --- a/src/adapters/helpers/lambdaEvent.ts +++ b/src/adapters/helpers/lambdaEvent.ts @@ -19,6 +19,8 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => { Object.keys(multiValueQueryStringParameters).forEach((key) => { if (!Array.isArray(multiValueQueryStringParameters[key])) { delete multiValueQueryStringParameters[key]; + } else { + delete params[key]; } }); @@ -71,10 +73,7 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => { userArn: null, }, }, - multiValueQueryStringParameters: - Object.keys(multiValueQueryStringParameters).length > 0 - ? multiValueQueryStringParameters - : null, + multiValueQueryStringParameters, }; if (Buffer.isBuffer(event.body)) { diff --git a/test/lambda-event.test.ts b/test/lambda-event.test.ts index 638ff71..48498bf 100644 --- a/test/lambda-event.test.ts +++ b/test/lambda-event.test.ts @@ -31,11 +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: { @@ -62,7 +57,7 @@ test('Can parse URLs without duplicates', () => { pageSize: '25', test: 'diffValue', }, - multiValueQueryStringParameters: null, + multiValueQueryStringParameters: {}, })); assertRequestId(result); });