Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1546 from CPAN-API/leo/caching_1
Leo/caching 1
- Loading branch information
Showing
12 changed files
with
195 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use MetaCPAN::Web::Test; | ||
|
||
my @tests = ( | ||
{ | ||
url => '/about' | ||
}, | ||
{ | ||
url => '/about/resources', | ||
}, | ||
); | ||
|
||
test_psgi app, sub { | ||
my $cb = shift; | ||
|
||
foreach my $test (@tests) { | ||
ok( my $res = $cb->( GET $test->{url} ), 'GET ' . $test->{url} ); | ||
is( $res->code, 200, 'code 200' ); | ||
test_cache_headers( | ||
$res, | ||
{ | ||
cache_control => 'max-age=86400', | ||
surrogate_key => 'about', | ||
surrogate_control => 'max-age=86400', | ||
} | ||
); | ||
} | ||
|
||
}; | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use MetaCPAN::Web::Test; | ||
|
||
test_psgi app, sub { | ||
my $cb = shift; | ||
ok( my $res = $cb->( GET q{/robots.txt} ), 'GET /robots.txt' ); | ||
is( $res->code, 200, 'code 200' ); | ||
|
||
SKIP: { | ||
skip 'Root controller is not serving /robots.txt!', 3; | ||
test_cache_headers( | ||
$res, | ||
{ | ||
cache_control => 'max-age=3600', | ||
surrogate_key => 'robots', | ||
surrogate_control => 'max-age=86400', | ||
} | ||
); | ||
} | ||
}; | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters