mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
[aws-lambda] Include CloudFrontRequest in CloudFrontRequestResult union type (#23882)
A request is a valid callback result type. See example: https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html#lambda-edge-authoring-functions-example-ab-testing
This commit is contained in:
@@ -631,7 +631,15 @@ let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.API
|
||||
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
|
||||
apiGtwProxyHandler = proxyHandler;
|
||||
|
||||
let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { };
|
||||
let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => {
|
||||
cb();
|
||||
cb(null);
|
||||
cb(new Error(''));
|
||||
cb(null, { clientIp: str, method: str, uri: str, querystring: str, headers: { } });
|
||||
cb(null, { status: str });
|
||||
// $ExpectError
|
||||
cb(null, { });
|
||||
};
|
||||
|
||||
let cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { };
|
||||
|
||||
|
||||
3
types/aws-lambda/index.d.ts
vendored
3
types/aws-lambda/index.d.ts
vendored
@@ -15,6 +15,7 @@
|
||||
// Palmi Valgeirsson <https://github.com/palmithor>
|
||||
// Danilo Raisi <https://github.com/daniloraisi>
|
||||
// Simon Buchan <https://github.com/simonbuchan>
|
||||
// David Hayden <https://github.com/Haydabase>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -516,7 +517,7 @@ export interface CloudFrontResponseEvent {
|
||||
}>;
|
||||
}
|
||||
|
||||
export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse;
|
||||
export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse | CloudFrontRequest;
|
||||
|
||||
export interface CloudFrontRequestEvent {
|
||||
Records: Array<{
|
||||
|
||||
Reference in New Issue
Block a user