Skip to content

Commit

Permalink
Merge pull request #73 from dankantor/fix-api-gateway-custom-authorizer
Browse files Browse the repository at this point in the history
fixes for api gateway authorizer
  • Loading branch information
dankantor authored Jul 28, 2017
2 parents a5d1850 + ea63a55 commit a3d11bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/internal/lambda-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ function convertAPIGatewayAuthorizerEvent(app, event, context) {
method: 'APIGATEWAYAUTHORIZEREVENT',
stage: stage,
path: '/' + path,
headers: "{Authorization=" + event.authorizationToken + "}",
headerNames: "[Authorization]"
headers: {
'Authorization': event.authorizationToken
},
body: event
};
}

Expand Down
12 changes: 9 additions & 3 deletions spec/internal/lambda-events-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ var SCHEDULED_EVENT = {

var API_GATEWAY_AUTHORIZER_EVENT = {
"authorizationToken": "Bearer foo",
"methodArn": "arn:aws:execute-api:us-east-1:282244745782:1tsgzwz575/dev/GET/auth",
"methodArn": "arn:aws:execute-api:us-east-1:123456789012/dev/GET/auth",
"type": "TOKEN"
};

Expand Down Expand Up @@ -312,8 +312,14 @@ describe('LambdaEvents#standardizeEvent', function() {
method: 'APIGATEWAYAUTHORIZEREVENT',
stage: 'dev',
path: '/GET/auth',
headers: '{Authorization=Bearer foo}',
headerNames: '[Authorization]'
headers: {
Authorization: 'Bearer foo'
},
body: {
authorizationToken: 'Bearer foo',
methodArn: 'arn:aws:execute-api:us-east-1:123456789012/dev/GET/auth',
type: 'TOKEN'
}
});
});

Expand Down

0 comments on commit a3d11bb

Please sign in to comment.