Skip to content

Commit

Permalink
Merge branch 'release/1.10.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
DianaIonita committed May 9, 2024
2 parents 2f438f4 + 0f6ac2d commit 096fa2f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
references:
container_config: &container_config
docker:
- image: circleci/node:12
- image: cimg/node:22.1.0
poke_npmrc: &poke_npmrc
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc

Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-api-gateway-caching",
"version": "1.10.3",
"version": "1.10.4",
"description": "A plugin for the serverless framework which helps with configuring caching for API Gateway endpoints.",
"main": "src/apiGatewayCachingPlugin.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/cacheKeyParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const applyCacheKeyParameterSettings = (settings, serverless) => {
for (let cacheKeyParameter of endpointSettings.cacheKeyParameters) {
if (!cacheKeyParameter.mappedFrom) {
let existingValue = method.Properties.RequestParameters[`method.${cacheKeyParameter.name}`];
method.Properties.RequestParameters[`method.${cacheKeyParameter.name}`] = (existingValue == null || existingValue == undefined) ? true : existingValue;
method.Properties.RequestParameters[`method.${cacheKeyParameter.name}`] = (existingValue == null || existingValue == undefined) ? false : existingValue;

// without this check, endpoints 500 when using cache key parameters like "Authorization" or headers with the same characters in different casing (e.g. "origin" and "Origin")
if (method.Properties.Integration.Type !== 'AWS_PROXY') {
Expand All @@ -43,7 +43,7 @@ const applyCacheKeyParameterSettings = (settings, serverless) => {
cacheKeyParameter.mappedFrom.includes('method.request.header') ||
cacheKeyParameter.mappedFrom.includes('method.request.path')
) {
method.Properties.RequestParameters[cacheKeyParameter.mappedFrom] = (existingValue == null || existingValue == undefined) ? true : existingValue;
method.Properties.RequestParameters[cacheKeyParameter.mappedFrom] = (existingValue == null || existingValue == undefined) ? false : existingValue;
}

// in v1.8.0 "lambda" integration check was removed because setting cache key parameters seemed to work for both AWS_PROXY and AWS (lambda) integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Configuring path parameters for additional endpoints defined as CloudF
for (let parameter of cacheKeyParameters) {
expect(apiGatewayMethod.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down
20 changes: 10 additions & 10 deletions test/configuring-cache-key-parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of cacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of cacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of cacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of firstEndpointCacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of secondEndpointCacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -399,7 +399,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of firstEndpointCacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -434,7 +434,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of secondEndpointCacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -506,7 +506,7 @@ describe('Configuring cache key parameters', () => {
for (let parameter of cacheKeyParameters) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[`method.${parameter.name}`]: true
[`method.${parameter.name}`]: false
});
}
});
Expand Down Expand Up @@ -568,7 +568,7 @@ describe('Configuring cache key parameters', () => {
) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[parameter.mappedFrom]: true
[parameter.mappedFrom]: false
});
}
}
Expand Down Expand Up @@ -609,7 +609,7 @@ describe('Configuring cache key parameters', () => {
) {
expect(method.Properties.RequestParameters)
.to.deep.include({
[parameter.mappedFrom]: true
[parameter.mappedFrom]: false
});
}
}
Expand Down

0 comments on commit 096fa2f

Please sign in to comment.