From 1833099f50a1876aa34c57d2492ab75e4fb314cc Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Sat, 22 Feb 2020 08:42:57 +1300 Subject: [PATCH] [aws-lambda] Add protocol to APIGatewayRequestContext. (#42419) Fixes #42049. No decent docs from AWS for the actual proxy integration, on the Lambda side or the API Gateway side, but there's an approximation on the API Gateway docs for the VTL $context variable: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference From experimentation, not all of the variables referenced above exist, at least most of the time, but everything except the `protocol` that was present in what I received already existed. --- types/aws-lambda/common/api-gateway.d.ts | 1 + types/aws-lambda/test/api-gateway-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/aws-lambda/common/api-gateway.d.ts b/types/aws-lambda/common/api-gateway.d.ts index f6090f2b5e..49e4b95b8d 100644 --- a/types/aws-lambda/common/api-gateway.d.ts +++ b/types/aws-lambda/common/api-gateway.d.ts @@ -9,6 +9,7 @@ export interface APIGatewayEventRequestContext { domainPrefix?: string; eventType?: string; extendedRequestId?: string; + protocol: string; httpMethod: string; identity: APIGatewayEventIdentity; messageDirection?: string; diff --git a/types/aws-lambda/test/api-gateway-tests.ts b/types/aws-lambda/test/api-gateway-tests.ts index 2ae90a6b4c..a91d338883 100644 --- a/types/aws-lambda/test/api-gateway-tests.ts +++ b/types/aws-lambda/test/api-gateway-tests.ts @@ -28,6 +28,7 @@ let proxyHandler: APIGatewayProxyHandler = async (event, context, callback) => { requestContext = event.requestContext; str = event.resource; + str = requestContext.protocol; str = requestContext.accountId; str = requestContext.apiId; const authContext: AuthResponseContext | null | undefined = requestContext.authorizer;