Skip to content

Commit

Permalink
refactor: remove old maker functions for api gateway objects
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusBaldi committed Jan 31, 2025
1 parent a7e9776 commit 623ffe8
Showing 1 changed file with 0 additions and 95 deletions.
95 changes: 0 additions & 95 deletions tests/samples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,103 +88,8 @@ export const handlerContext = (fillAllFields: boolean = false): Context => {
return ctx;
};

export const apiGatewayRequestContext = (): APIGatewayEventRequestContext => {
return {
accountId: '123456789012',
apiId: 'someapi',
authorizer: null,
httpMethod: 'GET',
identity: {
accessKey: null,
accountId: null,
apiKey: null,
apiKeyId: null,
caller: null,
clientCert: null,
cognitoAuthenticationProvider: null,
cognitoAuthenticationType: null,
cognitoIdentityId: null,
cognitoIdentityPoolId: null,
principalOrgId: null,
sourceIp: '12.12.12.12',
user: null,
userAgent: 'curl/7.54.0',
userArn: null,
},
path: '/prd',
protocol: 'HTTP/1.1',
stage: 'prd',
requestId: 'a507736b-259e-11e9-8fcf-4f1f08c4591e',
requestTimeEpoch: 1548969891530,
resourceId: 'reas23acc',
resourcePath: '/',
};
};

export const apiGatewayRequestRawQuery = '?&foo[a]=bar%20b&foo[a]=baz%20c&x=1&x=2&y=z';

export const apiGatewayRequest = (): APIGatewayRequestEvent => {
return {
body: null,
httpMethod: 'GET',
isBase64Encoded: false,
path: '/echo/asdf/a',
resource: '/{proxy+}',
pathParameters: { proxy: 'echo/asdf/a' },
stageVariables: null,
requestContext: apiGatewayRequestContext(),
headers: {
Accept: '*/*',
'CloudFront-Forwarded-Proto': 'https',
'CloudFront-Is-Desktop-Viewer': 'true',
'CloudFront-Is-Mobile-Viewer': 'false',
'CloudFront-Is-SmartTV-Viewer': 'false',
'CloudFront-Is-Tablet-Viewer': 'false',
'CloudFront-Viewer-Country': 'US',
Host: 'b5gee6dacf.execute-api.us-east-1.amazonaws.com',
'User-Agent': 'curl/7.54.0',
Via: '2.0 4ee511e558a0400aa4b9c1d34d92af5a.cloudfront.net (CloudFront)',
'X-Amz-Cf-Id': 'xn-ohXlUAed-32bae2cfb7164fd690ffffb87d36b032==',
'X-Amzn-Trace-Id': 'Root=1-4b5398e2-a7fbe4f92f2e911013cba76b',
'X-Forwarded-For': '8.8.8.8, 2.3.4.5',
'X-Forwarded-Port': '443',
'X-Forwarded-Proto': 'https',
Referer: 'https://en.wikipedia.org/wiki/HTTP_referer',
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',
},
multiValueHeaders: {
Accept: [ '*/*' ],
Foo: [ 'bar', 'baz' ],
'CloudFront-Forwarded-Proto': [ 'https' ],
'CloudFront-Is-Desktop-Viewer': [ 'true' ],
'CloudFront-Is-Mobile-Viewer': [ 'false' ],
'CloudFront-Is-SmartTV-Viewer': [ 'false' ],
'CloudFront-Is-Tablet-Viewer': [ 'false' ],
'CloudFront-Viewer-Country': [ 'US' ],
Host: [ 'b5gee6dacf.execute-api.us-east-1.amazonaws.com' ],
'User-Agent': [ 'curl/7.54.0' ],
Via: [ '2.0 4ee511e558a0400aa4b9c1d34d92af5a.cloudfront.net (CloudFront)' ],
'X-Amz-Cf-Id': [ 'xn-ohXlUAed-32bae2cfb7164fd690ffffb87d36b032==' ],
'X-Amzn-Trace-Id': [ 'Root=1-4b5398e2-a7fbe4f92f2e911013cba76b' ],
'X-Forwarded-For': [ '8.8.8.8, 2.3.4.5' ],
'X-Forwarded-Port': [ '443' ],
'X-Forwarded-Proto': [ 'https' ],
Referer: [ 'https://en.wikipedia.org/wiki/HTTP_referer' ],
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' ],
},
queryStringParameters: {
'foo[a]': 'bar b',
x: '2',
y: 'z',
},
multiValueQueryStringParameters: {
'foo[a]': [ 'bar b', 'baz c' ],
x: [ '1', '2' ],
y: [ 'z' ],
},
};
};

export const albRequestContext = (): ApplicationLoadBalancerEventRequestContext => {
return {
elb: {
Expand Down

0 comments on commit 623ffe8

Please sign in to comment.