@@ -67,103 +67,8 @@ export const handlerContext = (fillAllFields: boolean = false): Context => {
67
67
return ctx ;
68
68
} ;
69
69
70
- export const apiGatewayRequestContext = ( ) : APIGatewayEventRequestContext => {
71
- return {
72
- accountId : '123456789012' ,
73
- apiId : 'someapi' ,
74
- authorizer : null ,
75
- httpMethod : 'GET' ,
76
- identity : {
77
- accessKey : null ,
78
- accountId : null ,
79
- apiKey : null ,
80
- apiKeyId : null ,
81
- caller : null ,
82
- clientCert : null ,
83
- cognitoAuthenticationProvider : null ,
84
- cognitoAuthenticationType : null ,
85
- cognitoIdentityId : null ,
86
- cognitoIdentityPoolId : null ,
87
- principalOrgId : null ,
88
- sourceIp : '12.12.12.12' ,
89
- user : null ,
90
- userAgent : 'curl/7.54.0' ,
91
- userArn : null ,
92
- } ,
93
- path : '/prd' ,
94
- protocol : 'HTTP/1.1' ,
95
- stage : 'prd' ,
96
- requestId : 'a507736b-259e-11e9-8fcf-4f1f08c4591e' ,
97
- requestTimeEpoch : 1548969891530 ,
98
- resourceId : 'reas23acc' ,
99
- resourcePath : '/' ,
100
- } ;
101
- } ;
102
-
103
70
export const apiGatewayRequestRawQuery = '?&foo[a]=bar%20b&foo[a]=baz%20c&x=1&x=2&y=z' ;
104
71
105
- export const apiGatewayRequest = ( ) : APIGatewayRequestEvent => {
106
- return {
107
- body : null ,
108
- httpMethod : 'GET' ,
109
- isBase64Encoded : false ,
110
- path : '/echo/asdf/a' ,
111
- resource : '/{proxy+}' ,
112
- pathParameters : { proxy : 'echo/asdf/a' } ,
113
- stageVariables : null ,
114
- requestContext : apiGatewayRequestContext ( ) ,
115
- headers : {
116
- Accept : '*/*' ,
117
- 'CloudFront-Forwarded-Proto' : 'https' ,
118
- 'CloudFront-Is-Desktop-Viewer' : 'true' ,
119
- 'CloudFront-Is-Mobile-Viewer' : 'false' ,
120
- 'CloudFront-Is-SmartTV-Viewer' : 'false' ,
121
- 'CloudFront-Is-Tablet-Viewer' : 'false' ,
122
- 'CloudFront-Viewer-Country' : 'US' ,
123
- Host : 'b5gee6dacf.execute-api.us-east-1.amazonaws.com' ,
124
- 'User-Agent' : 'curl/7.54.0' ,
125
- Via : '2.0 4ee511e558a0400aa4b9c1d34d92af5a.cloudfront.net (CloudFront)' ,
126
- 'X-Amz-Cf-Id' : 'xn-ohXlUAed-32bae2cfb7164fd690ffffb87d36b032==' ,
127
- 'X-Amzn-Trace-Id' : 'Root=1-4b5398e2-a7fbe4f92f2e911013cba76b' ,
128
- 'X-Forwarded-For' : '8.8.8.8, 2.3.4.5' ,
129
- 'X-Forwarded-Port' : '443' ,
130
- 'X-Forwarded-Proto' : 'https' ,
131
- Referer : 'https://en.wikipedia.org/wiki/HTTP_referer' ,
132
- Cookie : 'uid=abc; ga=1234; foo=bar; baz=foo%5Ba%5D; obj=j%3A%7B%22abc%22%3A123%7D; onechar=j; bad=j%3A%7Ba%7D' ,
133
- } ,
134
- multiValueHeaders : {
135
- Accept : [ '*/*' ] ,
136
- Foo : [ 'bar' , 'baz' ] ,
137
- 'CloudFront-Forwarded-Proto' : [ 'https' ] ,
138
- 'CloudFront-Is-Desktop-Viewer' : [ 'true' ] ,
139
- 'CloudFront-Is-Mobile-Viewer' : [ 'false' ] ,
140
- 'CloudFront-Is-SmartTV-Viewer' : [ 'false' ] ,
141
- 'CloudFront-Is-Tablet-Viewer' : [ 'false' ] ,
142
- 'CloudFront-Viewer-Country' : [ 'US' ] ,
143
- Host : [ 'b5gee6dacf.execute-api.us-east-1.amazonaws.com' ] ,
144
- 'User-Agent' : [ 'curl/7.54.0' ] ,
145
- Via : [ '2.0 4ee511e558a0400aa4b9c1d34d92af5a.cloudfront.net (CloudFront)' ] ,
146
- 'X-Amz-Cf-Id' : [ 'xn-ohXlUAed-32bae2cfb7164fd690ffffb87d36b032==' ] ,
147
- 'X-Amzn-Trace-Id' : [ 'Root=1-4b5398e2-a7fbe4f92f2e911013cba76b' ] ,
148
- 'X-Forwarded-For' : [ '8.8.8.8, 2.3.4.5' ] ,
149
- 'X-Forwarded-Port' : [ '443' ] ,
150
- 'X-Forwarded-Proto' : [ 'https' ] ,
151
- Referer : [ 'https://en.wikipedia.org/wiki/HTTP_referer' ] ,
152
- Cookie : [ 'uid=abc; ga=1234; foo=bar; baz=foo%5Ba%5D; obj=j%3A%7B%22abc%22%3A123%7D; onechar=j; bad=j%3A%7Ba%7D' ] ,
153
- } ,
154
- queryStringParameters : {
155
- 'foo[a]' : 'bar b' ,
156
- x : '2' ,
157
- y : 'z' ,
158
- } ,
159
- multiValueQueryStringParameters : {
160
- 'foo[a]' : [ 'bar b' , 'baz c' ] ,
161
- x : [ '1' , '2' ] ,
162
- y : [ 'z' ] ,
163
- } ,
164
- } ;
165
- } ;
166
-
167
72
export const albRequestContext = ( ) : ApplicationLoadBalancerEventRequestContext => {
168
73
return {
169
74
elb : {
0 commit comments