[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.
This commit is contained in:
Simon Buchan
2020-02-21 11:42:57 -08:00
committed by GitHub
parent 4376032d36
commit 1833099f50
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -9,6 +9,7 @@ export interface APIGatewayEventRequestContext {
domainPrefix?: string;
eventType?: string;
extendedRequestId?: string;
protocol: string;
httpMethod: string;
identity: APIGatewayEventIdentity;
messageDirection?: string;
@@ -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;