Skip to content

Commit 9c06f29

Browse files
committed
made #125 more robust
1 parent 9d7a289 commit 9c06f29

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ module.exports = (app, options) => {
5252
} else if (event.queryStringParameters) {
5353
Object.keys(event.queryStringParameters).forEach((q) => {
5454
query[decodeURIComponent(q)] = decodeURIComponent(event.queryStringParameters[q])
55-
if (typeof query[decodeURIComponent(q)] === 'string' && query[decodeURIComponent(q)].indexOf(',') > 0) {
55+
if (event.version === '2.0' && typeof query[decodeURIComponent(q)] === 'string' && query[decodeURIComponent(q)].indexOf(',') > 0) {
5656
query[decodeURIComponent(q)] = query[decodeURIComponent(q)].split(',')
5757
}
5858
})
5959
}
6060
} else {
61-
if (event.queryStringParameters) {
61+
if (event.queryStringParameters && event.version === '2.0') {
6262
Object.keys(event.queryStringParameters).forEach((k) => {
6363
if (typeof event.queryStringParameters[k] === 'string' && event.queryStringParameters[k].indexOf(',') > 0) {
6464
event.queryStringParameters[k] = event.queryStringParameters[k].split(',')

test/basic.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ test('GET with multi-value query params (queryStringParameters)', async (t) => {
194194
const proxy = awsLambdaFastify(app)
195195

196196
const ret = await proxy({
197+
version: '2.0',
197198
httpMethod: 'GET',
198199
path: '/test',
199200
queryStringParameters: {

0 commit comments

Comments
 (0)