Skip to content

Commit 9a4cf90

Browse files
committed
Updated sample responses, and included necessary template definition
1 parent a84ab03 commit 9a4cf90

File tree

2 files changed

+47
-29
lines changed

2 files changed

+47
-29
lines changed

Examples/APIGatewayV1/README.md

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -71,47 +71,62 @@ Be sure to replace the URL with the API Gateway endpoint returned in the previou
7171

7272
This should print a JSON similar to
7373

74-
```bash
75-
{"version":"2.0","rawPath":"\/","isBase64Encoded":false,"rawQueryString":"","headers":{"user-agent":"curl\/8.7.1","accept":"*\/*","host":"a5q74es3k2.execute-api.us-east-1.amazonaws.com","content-length":"0","x-amzn-trace-id":"Root=1-66fb0388-691f744d4bd3c99c7436a78d","x-forwarded-port":"443","x-forwarded-for":"81.0.0.43","x-forwarded-proto":"https"},"requestContext":{"requestId":"e719cgNpoAMEcwA=","http":{"sourceIp":"81.0.0.43","path":"\/","protocol":"HTTP\/1.1","userAgent":"curl\/8.7.1","method":"GET"},"stage":"$default","apiId":"a5q74es3k2","time":"30\/Sep\/2024:20:01:12 +0000","timeEpoch":1727726472922,"domainPrefix":"a5q74es3k2","domainName":"a5q74es3k2.execute-api.us-east-1.amazonaws.com","accountId":"012345678901"}
74+
```bash
75+
{"httpMethod":"GET","queryStringParameters":{},"isBase64Encoded":false,"resource":"\/","path":"\/","headers":{"X-Forwarded-Port":"3000","X-Forwarded-Proto":"http","User-Agent":"curl\/8.7.1","Host":"localhost:3000","Accept":"*\/*"},"requestContext":{"resourcePath":"\/","identity":{"sourceIp":"127.0.0.1","userAgent":"Custom User Agent String"},"httpMethod":"GET","resourceId":"123456","accountId":"123456789012","apiId":"1234567890","requestId":"a9d2db08-8364-4da4-8237-8912bf8148c8","domainName":"localhost:3000","stage":"Prod","path":"\/"},"multiValueQueryStringParameters":{},"pathParameters":{},"multiValueHeaders":{"Accept":["*\/*"],"Host":["localhost:3000"],"X-Forwarded-Port":["3000"],"User-Agent":["curl\/8.7.1"],"X-Forwarded-Proto":["http"]},"stageVariables":{}}
7676
```
7777

7878
If you have `jq` installed, you can use it to pretty print the output.
7979

8080
```bash
8181
curl -s https://a5q74es3k2.execute-api.us-east-1.amazonaws.com | jq
8282
{
83-
"version": "2.0",
84-
"rawPath": "/",
83+
"stageVariables": {},
84+
"queryStringParameters": {},
85+
"multiValueHeaders": {
86+
"Accept": [
87+
"*/*"
88+
],
89+
"User-Agent": [
90+
"curl/8.7.1"
91+
],
92+
"X-Forwarded-Proto": [
93+
"http"
94+
],
95+
"Host": [
96+
"localhost:3000"
97+
],
98+
"X-Forwarded-Port": [
99+
"3000"
100+
]
101+
},
102+
"pathParameters": {},
103+
"isBase64Encoded": false,
104+
"path": "/",
85105
"requestContext": {
86-
"domainPrefix": "a5q74es3k2",
87-
"stage": "$default",
88-
"timeEpoch": 1727726558220,
89-
"http": {
90-
"protocol": "HTTP/1.1",
91-
"method": "GET",
92-
"userAgent": "curl/8.7.1",
93-
"path": "/",
94-
"sourceIp": "81.0.0.43"
106+
"apiId": "1234567890",
107+
"stage": "Prod",
108+
"httpMethod": "GET",
109+
"domainName": "localhost:3000",
110+
"requestId": "a9d2db08-8364-4da4-8237-8912bf8148c8",
111+
"identity": {
112+
"userAgent": "Custom User Agent String",
113+
"sourceIp": "127.0.0.1"
95114
},
96-
"apiId": "a5q74es3k2",
97-
"accountId": "012345678901",
98-
"requestId": "e72KxgsRoAMEMSA=",
99-
"domainName": "a5q74es3k2.execute-api.us-east-1.amazonaws.com",
100-
"time": "30/Sep/2024:20:02:38 +0000"
115+
"resourceId": "123456",
116+
"path": "/",
117+
"resourcePath": "/",
118+
"accountId": "123456789012"
101119
},
102-
"rawQueryString": "",
103-
"routeKey": "$default",
120+
"multiValueQueryStringParameters": {},
121+
"resource": "/",
104122
"headers": {
105-
"x-forwarded-for": "81.0.0.43",
106-
"user-agent": "curl/8.7.1",
107-
"host": "a5q74es3k2.execute-api.us-east-1.amazonaws.com",
108-
"accept": "*/*",
109-
"x-amzn-trace-id": "Root=1-66fb03de-07533930192eaf5f540db0cb",
110-
"content-length": "0",
111-
"x-forwarded-proto": "https",
112-
"x-forwarded-port": "443"
123+
"Accept": "*/*",
124+
"X-Forwarded-Proto": "http",
125+
"X-Forwarded-Port": "3000",
126+
"Host": "localhost:3000",
127+
"User-Agent": "curl/8.7.1"
113128
},
114-
"isBase64Encoded": false
129+
"httpMethod": "GET"
115130
}
116131
```
117132

Examples/APIGatewayV1/template.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Resources:
2323
Events:
2424
RestApi:
2525
Type: Api
26+
Properties:
27+
Path: /
28+
Method: GET
2629

2730
Outputs:
2831
# print API Gateway endpoint

0 commit comments

Comments
 (0)