Skip to content

Commit 06b6302

Browse files
committed
Merge remote-tracking branch 'refs/remotes/dherault/master'
# Conflicts: # src/index.js
2 parents d8fd826 + f6c0f42 commit 06b6302

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "serverless-offline",
3-
"version": "3.13.3",
3+
"version": "3.13.4",
44
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
55
"main": "src/index.js",
66
"scripts": {
@@ -36,6 +36,7 @@
3636
"Ben Cooling (https://github.com/bencooling)",
3737
"Cameron Cooper (https://github.com/cameroncooper)",
3838
"Chris Trevino (https://github.com/darthtrevino)",
39+
"Christoph Gysin (https://github.com/christophgysin)",
3940
"Daniel Parker (https://github.com/rlgod)",
4041
"Dave Sole (https://github.com/dsole)",
4142
"David Bunker (https://github.com/dbunker)",

src/index.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class Offline {
336336
this.serverlessLog(`Routes for ${funName}:`);
337337

338338
// Adds a route for each http endpoint
339-
fun.events.forEach(event => {
339+
fun.events && fun.events.forEach(event => {
340340

341341
if (!event.http) return;
342342
if (_.eq(event.http.private, true)) {
@@ -383,13 +383,13 @@ class Offline {
383383

384384
// Route creation
385385
const routeMethod = method === 'ANY' ? '*' : method;
386-
let routeConfig = {
386+
const routeConfig = {
387387
cors,
388388
auth: authStrategyName,
389389
};
390390

391-
if(routeMethod !== 'HEAD' && routeMethod !== 'GET'){
392-
routeConfig.payload = { parse: false }
391+
if (routeMethod !== 'HEAD' && routeMethod !== 'GET') {
392+
routeConfig.payload = { parse: false };
393393
}
394394

395395
this.server.route({
@@ -747,16 +747,14 @@ class Offline {
747747
if (!authFunction) return this.serverlessLog(`WARNING: Authorization function ${authFunctionName} does not exist`);
748748

749749
let authorizerOptions = {};
750+
authorizerOptions.resultTtlInSeconds = '300';
751+
authorizerOptions.identitySource = 'method.request.header.Authorization';
752+
750753
if (typeof endpoint.authorizer === 'string') {
751-
// serverless 1.x will create default values, so we will to
752754
authorizerOptions.name = authFunctionName;
753-
authorizerOptions.resultTtlInSeconds = '300';
754-
authorizerOptions.identitySource = 'method.request.header.Authorization';
755755
}
756756
else {
757-
authorizerOptions.identitySource = endpoint.authorizer.identitySource ||
758-
'method.request.header.Authorization'; // See #207
759-
authorizerOptions = endpoint.authorizer;
757+
Object.assign(authorizerOptions, endpoint.authorizer);
760758
}
761759

762760
// Create a unique scheme per endpoint

0 commit comments

Comments
 (0)