File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ const loadProbot = appFn => {
21
21
return probot
22
22
}
23
23
24
+ const lowerCaseKeys = obj =>
25
+ Object . keys ( obj ) . reduce ( ( accumulator , key ) =>
26
+ Object . assign ( accumulator , { [ key . toLocaleLowerCase ( ) ] : obj [ key ] } ) , { } )
27
+
24
28
module . exports . serverless = appFn => {
25
29
return async ( event , context ) => {
26
30
// 🤖 A friendly homepage if there isn't a payload
@@ -42,7 +46,8 @@ module.exports.serverless = appFn => {
42
46
context . callbackWaitsForEmptyEventLoop = false
43
47
44
48
// Determine incoming webhook event type
45
- const e = event . headers [ 'x-github-event' ] || event . headers [ 'X-GitHub-Event' ]
49
+ const headers = lowerCaseKeys ( event . headers )
50
+ const e = headers [ 'x-github-event' ]
46
51
47
52
// Convert the payload to an Object if API Gateway stringifies it
48
53
event . body = ( typeof event . body === 'string' ) ? JSON . parse ( event . body ) : event . body
You can’t perform that action at this time.
0 commit comments