Skip to content

Commit 83ff70b

Browse files
authored
Merge pull request #184 from lifeomic/avoid-duplicate-query-parmas
Don't duplicate Lambda Event Params
2 parents d2d866c + 277c206 commit 83ff70b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/adapters/helpers/lambdaEvent.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => {
2121
if (hasMultiValueParams) {
2222
Object.entries(params).forEach(([key, value]) => {
2323
multiValueParams = multiValueParams || {};
24-
multiValueParams[key] = Array.isArray(value) ? value : [value];
25-
params[key] = Array.isArray(value) ? value.join(',') : value;
24+
if (Array.isArray(value)) {
25+
multiValueParams[key] = value;
26+
delete params[key];
27+
}
2628
});
2729
}
2830

test/lambda-event.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ test('Can parse URLs with duplicate parameters', () => {
3131
httpMethod: 'GET',
3232
path: '/lifeomic/dstu3/Questionnaire',
3333
queryStringParameters: {
34-
_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',
3534
pageSize: '25',
3635
},
3736
multiValueQueryStringParameters: {
@@ -40,7 +39,6 @@ test('Can parse URLs with duplicate parameters', () => {
4039
'http://lifeomic.com/fhir/dataset|0bb18fef-4e2d-4b91-a623-09527265a8b3',
4140
'http://lifeomic.com/fhir/primary|0343bfcf-4e2d-4b91-a623-095272783bf3',
4241
],
43-
pageSize: ['25'],
4442
},
4543
}));
4644
assertRequestId(result);

0 commit comments

Comments
 (0)