@@ -88,103 +88,8 @@ export const handlerContext = (fillAllFields: boolean = false): Context => {
8888 return ctx ;
8989} ;
9090
91- export const apiGatewayRequestContext = ( ) : APIGatewayEventRequestContext => {
92- return {
93- accountId : '123456789012' ,
94- apiId : 'someapi' ,
95- authorizer : null ,
96- httpMethod : 'GET' ,
97- identity : {
98- accessKey : null ,
99- accountId : null ,
100- apiKey : null ,
101- apiKeyId : null ,
102- caller : null ,
103- clientCert : null ,
104- cognitoAuthenticationProvider : null ,
105- cognitoAuthenticationType : null ,
106- cognitoIdentityId : null ,
107- cognitoIdentityPoolId : null ,
108- principalOrgId : null ,
109- sourceIp : '12.12.12.12' ,
110- user : null ,
111- userAgent : 'curl/7.54.0' ,
112- userArn : null ,
113- } ,
114- path : '/prd' ,
115- protocol : 'HTTP/1.1' ,
116- stage : 'prd' ,
117- requestId : 'a507736b-259e-11e9-8fcf-4f1f08c4591e' ,
118- requestTimeEpoch : 1548969891530 ,
119- resourceId : 'reas23acc' ,
120- resourcePath : '/' ,
121- } ;
122- } ;
123-
12491export const apiGatewayRequestRawQuery = '?&foo[a]=bar%20b&foo[a]=baz%20c&x=1&x=2&y=z' ;
12592
126- export const apiGatewayRequest = ( ) : APIGatewayRequestEvent => {
127- return {
128- body : null ,
129- httpMethod : 'GET' ,
130- isBase64Encoded : false ,
131- path : '/echo/asdf/a' ,
132- resource : '/{proxy+}' ,
133- pathParameters : { proxy : 'echo/asdf/a' } ,
134- stageVariables : null ,
135- requestContext : apiGatewayRequestContext ( ) ,
136- headers : {
137- Accept : '*/*' ,
138- 'CloudFront-Forwarded-Proto' : 'https' ,
139- 'CloudFront-Is-Desktop-Viewer' : 'true' ,
140- 'CloudFront-Is-Mobile-Viewer' : 'false' ,
141- 'CloudFront-Is-SmartTV-Viewer' : 'false' ,
142- 'CloudFront-Is-Tablet-Viewer' : 'false' ,
143- 'CloudFront-Viewer-Country' : 'US' ,
144- Host : 'b5gee6dacf.execute-api.us-east-1.amazonaws.com' ,
145- 'User-Agent' : 'curl/7.54.0' ,
146- Via : '2.0 4ee511e558a0400aa4b9c1d34d92af5a.cloudfront.net (CloudFront)' ,
147- 'X-Amz-Cf-Id' : 'xn-ohXlUAed-32bae2cfb7164fd690ffffb87d36b032==' ,
148- 'X-Amzn-Trace-Id' : 'Root=1-4b5398e2-a7fbe4f92f2e911013cba76b' ,
149- 'X-Forwarded-For' : '8.8.8.8, 2.3.4.5' ,
150- 'X-Forwarded-Port' : '443' ,
151- 'X-Forwarded-Proto' : 'https' ,
152- Referer : 'https://en.wikipedia.org/wiki/HTTP_referer' ,
153- 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' ,
154- } ,
155- multiValueHeaders : {
156- Accept : [ '*/*' ] ,
157- Foo : [ 'bar' , 'baz' ] ,
158- 'CloudFront-Forwarded-Proto' : [ 'https' ] ,
159- 'CloudFront-Is-Desktop-Viewer' : [ 'true' ] ,
160- 'CloudFront-Is-Mobile-Viewer' : [ 'false' ] ,
161- 'CloudFront-Is-SmartTV-Viewer' : [ 'false' ] ,
162- 'CloudFront-Is-Tablet-Viewer' : [ 'false' ] ,
163- 'CloudFront-Viewer-Country' : [ 'US' ] ,
164- Host : [ 'b5gee6dacf.execute-api.us-east-1.amazonaws.com' ] ,
165- 'User-Agent' : [ 'curl/7.54.0' ] ,
166- Via : [ '2.0 4ee511e558a0400aa4b9c1d34d92af5a.cloudfront.net (CloudFront)' ] ,
167- 'X-Amz-Cf-Id' : [ 'xn-ohXlUAed-32bae2cfb7164fd690ffffb87d36b032==' ] ,
168- 'X-Amzn-Trace-Id' : [ 'Root=1-4b5398e2-a7fbe4f92f2e911013cba76b' ] ,
169- 'X-Forwarded-For' : [ '8.8.8.8, 2.3.4.5' ] ,
170- 'X-Forwarded-Port' : [ '443' ] ,
171- 'X-Forwarded-Proto' : [ 'https' ] ,
172- Referer : [ 'https://en.wikipedia.org/wiki/HTTP_referer' ] ,
173- 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' ] ,
174- } ,
175- queryStringParameters : {
176- 'foo[a]' : 'bar b' ,
177- x : '2' ,
178- y : 'z' ,
179- } ,
180- multiValueQueryStringParameters : {
181- 'foo[a]' : [ 'bar b' , 'baz c' ] ,
182- x : [ '1' , '2' ] ,
183- y : [ 'z' ] ,
184- } ,
185- } ;
186- } ;
187-
18893export const albRequestContext = ( ) : ApplicationLoadBalancerEventRequestContext => {
18994 return {
19095 elb : {
0 commit comments