Skip to content

Commit

Permalink
refactor index.js endpointResponseHeaders for inegration lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
dherault committed Mar 30, 2019
1 parent 445ebc2 commit 37d6823
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/index.js
Expand Up @@ -788,8 +788,7 @@ class Offline {

if (integration === 'lambda') {

const endpointResponseHeaders = (typeof endpoint.response !== 'undefined'
&& typeof endpoint.response.headers !== 'undefined') ? endpoint.response.headers : {};
const endpointResponseHeaders = (endpoint.response && endpoint.response.headers) || {};

Object.keys(endpointResponseHeaders)
.filter(key => typeof endpointResponseHeaders[key] === 'string' && /^'.*?'$/.test(endpointResponseHeaders[key]))
Expand Down Expand Up @@ -1164,7 +1163,7 @@ class Offline {
if (request.url.search !== null) {
resultUri += request.url.search; // search is empty string by default
}

this.serverlessLog(`PROXY ${request.method} ${request.url.path} -> ${resultUri}`);
reply.proxy({ uri: resultUri, passThrough: true });
},
Expand Down

0 comments on commit 37d6823

Please sign in to comment.