Skip to content

Commit 116949d

Browse files
committed
fix: add body parsing for lambda edge event source
1 parent 172069d commit 116949d

File tree

10 files changed

+1380
-4073
lines changed

10 files changed

+1380
-4073
lines changed

examples/lambda-edge/lambda-edge-event.json

Lines changed: 95 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,114 @@
33
{
44
"cf": {
55
"config": {
6-
"distributionId": "EXAMPLE"
6+
"distributionDomainName": "d3qj9vk9486y6c.cloudfront.net",
7+
"distributionId": "E2I5C7O4FEQEKZ",
8+
"eventType": "viewer-request",
9+
"requestId": "BKXC0kFgBfWSEgribSo9EwziZB1FztiXQ96VRvTfFNHYCBv7Ko-RBQ=="
710
},
811
"request": {
12+
"body": {
13+
"action": "read-only",
14+
"data": "eyJuYW1lIjoiU2FtIn0=",
15+
"encoding": "base64",
16+
"inputTruncated": false
17+
},
18+
"clientIp": "203.123.103.37",
919
"headers": {
1020
"host": [
1121
{
1222
"key": "Host",
13-
"value": "d123.cf.net"
23+
"value": "d3qj9vk9486y6c.cloudfront.net"
1424
}
1525
],
16-
"user-name": [
26+
"user-agent": [
1727
{
18-
"key": "User-Name",
19-
"value": "CloudFront"
28+
"key": "User-Agent",
29+
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36"
2030
}
21-
]
22-
},
23-
"clientIp": "2001:cdba::3257:9652",
24-
"uri": "/users",
25-
"method": "GET"
26-
},
27-
"response": {
28-
"status": "200",
29-
"statusDescription": "OK",
30-
"headers": {
31-
"x-cache": [
31+
],
32+
"content-length": [
33+
{
34+
"key": "content-length",
35+
"value": "14"
36+
}
37+
],
38+
"cache-control": [
39+
{
40+
"key": "Cache-Control",
41+
"value": "max-age=0"
42+
}
43+
],
44+
"accept": [
45+
{
46+
"key": "accept",
47+
"value": "application/json,text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
48+
}
49+
],
50+
"if-none-match": [
3251
{
33-
"key": "X-Cache",
34-
"value": "Hello from Cloudfront"
52+
"key": "if-none-match",
53+
"value": "W/\"2e-Lu6qxFOQSPFulDAGUFiiK6QgREo\""
54+
}
55+
],
56+
"accept-language": [
57+
{
58+
"key": "accept-language",
59+
"value": "en-US,en;q=0.9"
60+
}
61+
],
62+
"upgrade-insecure-requests": [
63+
{
64+
"key": "upgrade-insecure-requests",
65+
"value": "1"
66+
}
67+
],
68+
"content-type": [
69+
{
70+
"key": "content-type",
71+
"value": "application/json"
72+
}
73+
],
74+
"origin": [
75+
{
76+
"key": "Origin",
77+
"value": "https://d3qj9vk9486y6c.cloudfront.net"
78+
}
79+
],
80+
"sec-fetch-site": [
81+
{
82+
"key": "Sec-Fetch-Site",
83+
"value": "same-origin"
84+
}
85+
],
86+
"sec-fetch-mode": [
87+
{
88+
"key": "Sec-Fetch-Mode",
89+
"value": "cors"
90+
}
91+
],
92+
"sec-fetch-dest": [
93+
{
94+
"key": "Sec-Fetch-Dest",
95+
"value": "empty"
96+
}
97+
],
98+
"referer": [
99+
{
100+
"key": "Referer",
101+
"value": "https://d3qj9vk9486y6c.cloudfront.net/users"
102+
}
103+
],
104+
"accept-encoding": [
105+
{
106+
"key": "Accept-Encoding",
107+
"value": "gzip, deflate, br"
35108
}
36109
]
37-
}
110+
},
111+
"method": "POST",
112+
"querystring": "",
113+
"uri": "/users"
38114
}
39115
}
40116
}

0 commit comments

Comments
 (0)