Skip to content
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
11 changes: 10 additions & 1 deletion src/adapters/helpers/lambdaEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ export const lambdaEvent = (config: AlphaOptions, relativeUrl?: string) => {
querystringWithArraySupport,
);
const params = Object.assign({}, parts.query, config.params);
const multiValueQueryStringParameters: Record<string, any> = { ...params };

Object.keys(multiValueQueryStringParameters).forEach((key) => {
if (!Array.isArray(multiValueQueryStringParameters[key])) {
delete multiValueQueryStringParameters[key];
} else {
delete params[key];
}
});

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

if (Buffer.isBuffer(event.body)) {
Expand Down
5 changes: 4 additions & 1 deletion test/lambda-event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ test('Can parse URLs with duplicate parameters', () => {
httpMethod: 'GET',
path: '/lifeomic/dstu3/Questionnaire',
queryStringParameters: {
pageSize: '25',
},
multiValueQueryStringParameters: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this not be a breaking change in alpha since queryStringParameters will now never include any array query params?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that does seem breaking. I'll update it.

_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 @@ -55,6 +57,7 @@ test('Can parse URLs without duplicates', () => {
pageSize: '25',
test: 'diffValue',
},
multiValueQueryStringParameters: {},
}));
assertRequestId(result);
});
Expand Down