@@ -336,7 +336,7 @@ class Offline {
336
336
this . serverlessLog ( `Routes for ${ funName } :` ) ;
337
337
338
338
// Adds a route for each http endpoint
339
- fun . events . forEach ( event => {
339
+ fun . events && fun . events . forEach ( event => {
340
340
341
341
if ( ! event . http ) return ;
342
342
if ( _ . eq ( event . http . private , true ) ) {
@@ -383,13 +383,13 @@ class Offline {
383
383
384
384
// Route creation
385
385
const routeMethod = method === 'ANY' ? '*' : method ;
386
- let routeConfig = {
386
+ const routeConfig = {
387
387
cors,
388
388
auth : authStrategyName ,
389
389
} ;
390
390
391
- if ( routeMethod !== 'HEAD' && routeMethod !== 'GET' ) {
392
- routeConfig . payload = { parse : false }
391
+ if ( routeMethod !== 'HEAD' && routeMethod !== 'GET' ) {
392
+ routeConfig . payload = { parse : false } ;
393
393
}
394
394
395
395
this . server . route ( {
@@ -747,16 +747,14 @@ class Offline {
747
747
if ( ! authFunction ) return this . serverlessLog ( `WARNING: Authorization function ${ authFunctionName } does not exist` ) ;
748
748
749
749
let authorizerOptions = { } ;
750
+ authorizerOptions . resultTtlInSeconds = '300' ;
751
+ authorizerOptions . identitySource = 'method.request.header.Authorization' ;
752
+
750
753
if ( typeof endpoint . authorizer === 'string' ) {
751
- // serverless 1.x will create default values, so we will to
752
754
authorizerOptions . name = authFunctionName ;
753
- authorizerOptions . resultTtlInSeconds = '300' ;
754
- authorizerOptions . identitySource = 'method.request.header.Authorization' ;
755
755
}
756
756
else {
757
- authorizerOptions . identitySource = endpoint . authorizer . identitySource ||
758
- 'method.request.header.Authorization' ; // See #207
759
- authorizerOptions = endpoint . authorizer ;
757
+ Object . assign ( authorizerOptions , endpoint . authorizer ) ;
760
758
}
761
759
762
760
// Create a unique scheme per endpoint
0 commit comments