Skip to content

Commit

Permalink
Merge pull request #184 from lifeomic/avoid-duplicate-query-parmas
Browse files Browse the repository at this point in the history
Don't duplicate Lambda Event Params
  • Loading branch information
sternetj authored Dec 13, 2024
2 parents d2d866c + 277c206 commit 83ff70b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/adapters/helpers/lambdaEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
});
}

Expand Down
2 changes: 0 additions & 2 deletions test/lambda-event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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);
Expand Down

0 comments on commit 83ff70b

Please sign in to comment.