Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove multiValueQueryStringParameters Logic #185

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading