Skip to content

Commit 3fe7069

Browse files
committed
conform to styleguide
1 parent 06b6fc5 commit 3fe7069

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
'use strict'
1616
const http = require('http')
17-
const binarycase = require('binary-case');
17+
const binarycase = require('binary-case')
1818

1919
function getPathWithQueryStringParams(event) {
2020
const queryStringKeys = Object.keys(event.queryStringParameters || {})
@@ -56,13 +56,15 @@ function forwardResponseToApiGateway(server, response, context) {
5656
const statusCode = response.statusCode
5757
const headers = response.headers
5858

59+
// HACK: modifies header casing to get around API Gateway's limitation of not allowing multiple
60+
// headers with the same name, as discussed on the AWS Forum https://forums.aws.amazon.com/message.jspa?messageID=725953#725953
5961
Object.keys(headers)
6062
.forEach(h => {
6163
if(Array.isArray(headers[h])) {
6264
headers[h].forEach((value, i) => {
63-
headers[binarycase(h, i + 1)] = value;
64-
});
65-
delete headers[h];
65+
headers[binarycase(h, i + 1)] = value
66+
})
67+
delete headers[h]
6668
}
6769
})
6870

0 commit comments

Comments
 (0)