Skip to content

Commit

Permalink
fix: Remove multiValueQueryStringParameters Logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sternetj committed Dec 16, 2024
1 parent 83ff70b commit 8c28831
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
17 changes: 2 additions & 15 deletions src/adapters/helpers/lambdaEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => {
'http://fake',
querystringWithArraySupport,
);
const params: Record<string, any> = Object.assign({}, parts.query, config.params);
let multiValueParams: Record<string, any[]> | null = null;

const hasMultiValueParams = Object.values(params).some((value) => Array.isArray(value));

if (hasMultiValueParams) {
Object.entries(params).forEach(([key, value]) => {
multiValueParams = multiValueParams || {};
if (Array.isArray(value)) {
multiValueParams[key] = value;
delete params[key];
}
});
}
const params = Object.assign({}, parts.query, config.params);

const httpMethod = (config.method as string).toUpperCase();
const requestTime = new Date();
Expand Down Expand Up @@ -77,7 +64,7 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => {
userArn: null,
},
},
multiValueQueryStringParameters: multiValueParams,
multiValueQueryStringParameters: null,
};

if (Buffer.isBuffer(event.body)) {
Expand Down
5 changes: 1 addition & 4 deletions test/lambda-event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ test('Can parse URLs with duplicate parameters', () => {
httpMethod: 'GET',
path: '/lifeomic/dstu3/Questionnaire',
queryStringParameters: {
pageSize: '25',
},
multiValueQueryStringParameters: {
_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',
},
}));
assertRequestId(result);
Expand All @@ -57,7 +55,6 @@ test('Can parse URLs without duplicates', () => {
pageSize: '25',
test: 'diffValue',
},
multiValueQueryStringParameters: null,
}));
assertRequestId(result);
});
Expand Down

0 comments on commit 8c28831

Please sign in to comment.