Skip to content

Commit

Permalink
Remove array values from queryStringParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sternetj committed Nov 4, 2024
1 parent 44b021b commit c5ef54a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/adapters/helpers/lambdaEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
});

Expand Down Expand Up @@ -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)) {
Expand Down
7 changes: 1 addition & 6 deletions test/lambda-event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -62,7 +57,7 @@ test('Can parse URLs without duplicates', () => {
pageSize: '25',
test: 'diffValue',
},
multiValueQueryStringParameters: null,
multiValueQueryStringParameters: {},
}));
assertRequestId(result);
});
Expand Down

0 comments on commit c5ef54a

Please sign in to comment.