diff --git a/types/aws-cloudfront-function/aws-cloudfront-function-tests.ts b/types/aws-cloudfront-function/aws-cloudfront-function-tests.ts index 2bac3e09e40e74..b5da066f0a0c0f 100644 --- a/types/aws-cloudfront-function/aws-cloudfront-function-tests.ts +++ b/types/aws-cloudfront-function/aws-cloudfront-function-tests.ts @@ -30,6 +30,13 @@ const cloudFrontFunctionResponseCookie: AWSCloudFrontFunction.ResponseCookie = { }, }; +const responseBodyString: string = "Hello, World!"; + +const responseBodyObject: AWSCloudFrontFunction.ResponseBody = { + data: "Hello", + encoding: "text", +}; + const cloudFrontFunctionRequest: AWSCloudFrontFunction.Request = { method: "GET", uri: "/test", @@ -45,6 +52,22 @@ const cloudFrontResponse: AWSCloudFrontFunction.Response = { cookies: cloudFrontFunctionResponseCookie, }; +const cloudFrontResponse2: AWSCloudFrontFunction.Response = { + statusCode: 200, + statusDescription: "OK", + headers: cloudFrontFunctionValue, + cookies: cloudFrontFunctionResponseCookie, + body: responseBodyString, +}; + +const cloudFrontResponse3: AWSCloudFrontFunction.Response = { + statusCode: 200, + statusDescription: "OK", + headers: cloudFrontFunctionValue, + cookies: cloudFrontFunctionResponseCookie, + body: responseBodyObject, +}; + const cloudFrontFunctionViewer: AWSCloudFrontFunction.Viewer = { ip: "192.168.0.1", }; diff --git a/types/aws-cloudfront-function/index.d.ts b/types/aws-cloudfront-function/index.d.ts index 6990f678435755..aad317719bfc16 100644 --- a/types/aws-cloudfront-function/index.d.ts +++ b/types/aws-cloudfront-function/index.d.ts @@ -31,6 +31,12 @@ declare namespace AWSCloudFrontFunction { statusDescription?: string; headers?: ValueObject; cookies?: ResponseCookie; + body?: string | ResponseBody; + } + + interface ResponseBody { + data: string; + encoding: "text" | "base64"; } interface ValueObject {