Skip to content

Commit c49e9c6

Browse files
committed
parse headers in parseEvent hook
1 parent b9e7738 commit c49e9c6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/hooks/parseEvent.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@ import { Hook } from '../index'
22

33
export const parseEvent: Hook = async state => {
44
const { event } = state
5-
const { body, pathParameters, queryStringParameters, multiValueQueryStringParameters } = event
5+
const {
6+
body,
7+
pathParameters,
8+
queryStringParameters,
9+
multiValueQueryStringParameters,
10+
headers,
11+
} = event
612

713
if (typeof body === 'string') {
814
event.body = JSON.parse(body)
915
}
1016

17+
if (typeof headers === 'string') {
18+
event.headers = JSON.parse(headers)
19+
}
20+
1121
if (!pathParameters) {
1222
event.pathParameters = {}
1323
}

0 commit comments

Comments
 (0)