Skip to content

Commit

Permalink
fix(aws-cloudfront): IncludeBody option only with viewer-request or o…
Browse files Browse the repository at this point in the history
…rigin-request (#533)
  • Loading branch information
Enalmada committed Aug 9, 2020
1 parent e7ad5f6 commit 5c4b2c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ Object {
},
Object {
"EventType": "origin-response",
"IncludeBody": true,
"IncludeBody": undefined,
"LambdaFunctionARN": "arn:aws:lambda:us-east-1:123:function:originResponseFunction",
},
Object {
"EventType": "viewer-response",
"IncludeBody": true,
"IncludeBody": undefined,
"LambdaFunctionARN": "arn:aws:lambda:us-east-1:123:function:viewerResponseFunction",
},
],
Expand Down
6 changes: 2 additions & 4 deletions packages/aws-cloudfront/__tests__/lambda-at-edge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ describe("Input origin as a custom url", () => {
{
EventType: "origin-response",
LambdaFunctionARN:
"arn:aws:lambda:us-east-1:123:function:originResponseFunction",
IncludeBody: true
"arn:aws:lambda:us-east-1:123:function:originResponseFunction"
},
{
EventType: "viewer-response",
LambdaFunctionARN:
"arn:aws:lambda:us-east-1:123:function:viewerResponseFunction",
IncludeBody: true
"arn:aws:lambda:us-east-1:123:function:viewerResponseFunction"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = (cacheBehavior, lambdaAtEdgeConfig = {}) => {
cacheBehavior.LambdaFunctionAssociations.Items.push({
EventType: eventType,
LambdaFunctionARN: lambdaAtEdgeConfig[eventType],
IncludeBody: true
IncludeBody: eventType.includes("request") ? true : undefined
});
});
};

0 comments on commit 5c4b2c4

Please sign in to comment.