Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 5c4b2c4

Browse files
authored
fix(aws-cloudfront): IncludeBody option only with viewer-request or origin-request (#533)
1 parent e7ad5f6 commit 5c4b2c4

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

packages/aws-cloudfront/__tests__/__snapshots__/lambda-at-edge.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ Object {
5555
},
5656
Object {
5757
"EventType": "origin-response",
58-
"IncludeBody": true,
58+
"IncludeBody": undefined,
5959
"LambdaFunctionARN": "arn:aws:lambda:us-east-1:123:function:originResponseFunction",
6060
},
6161
Object {
6262
"EventType": "viewer-response",
63-
"IncludeBody": true,
63+
"IncludeBody": undefined,
6464
"LambdaFunctionARN": "arn:aws:lambda:us-east-1:123:function:viewerResponseFunction",
6565
},
6666
],

packages/aws-cloudfront/__tests__/lambda-at-edge.test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,12 @@ describe("Input origin as a custom url", () => {
6464
{
6565
EventType: "origin-response",
6666
LambdaFunctionARN:
67-
"arn:aws:lambda:us-east-1:123:function:originResponseFunction",
68-
IncludeBody: true
67+
"arn:aws:lambda:us-east-1:123:function:originResponseFunction"
6968
},
7069
{
7170
EventType: "viewer-response",
7271
LambdaFunctionARN:
73-
"arn:aws:lambda:us-east-1:123:function:viewerResponseFunction",
74-
IncludeBody: true
72+
"arn:aws:lambda:us-east-1:123:function:viewerResponseFunction"
7573
}
7674
]
7775
}

packages/aws-cloudfront/lib/addLambdaAtEdgeToCacheBehavior.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = (cacheBehavior, lambdaAtEdgeConfig = {}) => {
1919
cacheBehavior.LambdaFunctionAssociations.Items.push({
2020
EventType: eventType,
2121
LambdaFunctionARN: lambdaAtEdgeConfig[eventType],
22-
IncludeBody: true
22+
IncludeBody: eventType.includes("request") ? true : undefined
2323
});
2424
});
2525
};

0 commit comments

Comments
 (0)