Skip to content

Commit

Permalink
fix(aws-s3-deployment): Set proper s-maxage Cache Control header (aws…
Browse files Browse the repository at this point in the history
…#8434)

Both the aws-s3-deployment and aws-codepipeline-actions CacheControl class uses
"s-max-age" instead of the correct "s-maxage". This change fixes to the correct
header value.

fixes aws#6292


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
njlynch authored Jun 8, 2020
1 parent 00884c7 commit 8d5b801
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class CacheControl {
/** The 'max-age' cache control directive. */
public static maxAge(t: Duration) { return new CacheControl(`max-age: ${t.toSeconds()}`); }
/** The 's-max-age' cache control directive. */
public static sMaxAge(t: Duration) { return new CacheControl(`s-max-age: ${t.toSeconds()}`); }
public static sMaxAge(t: Duration) { return new CacheControl(`s-maxage: ${t.toSeconds()}`); }
/**
* Allows you to create an arbitrary cache control directive,
* in case our support is missing a method for a particular directive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class CacheControl {
public static setPrivate() { return new CacheControl('private'); }
public static proxyRevalidate() { return new CacheControl('proxy-revalidate'); }
public static maxAge(t: cdk.Duration) { return new CacheControl(`max-age=${t.toSeconds()}`); }
public static sMaxAge(t: cdk.Duration) { return new CacheControl(`s-max-age=${t.toSeconds()}`); }
public static sMaxAge(t: cdk.Duration) { return new CacheControl(`s-maxage=${t.toSeconds()}`); }
public static fromString(s: string) { return new CacheControl(s); }

private constructor(public readonly value: any) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export = {
test.equal(s3deploy.CacheControl.setPrivate().value, 'private');
test.equal(s3deploy.CacheControl.proxyRevalidate().value, 'proxy-revalidate');
test.equal(s3deploy.CacheControl.maxAge(cdk.Duration.minutes(1)).value, 'max-age=60');
test.equal(s3deploy.CacheControl.sMaxAge(cdk.Duration.minutes(1)).value, 's-max-age=60');
test.equal(s3deploy.CacheControl.sMaxAge(cdk.Duration.minutes(1)).value, 's-maxage=60');
test.equal(s3deploy.CacheControl.fromString('only-if-cached').value, 'only-if-cached');

test.done();
Expand Down

0 comments on commit 8d5b801

Please sign in to comment.