Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vary-dynamic test #54

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions tests/vary.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,67 @@ export default {
}
]
},
{
name: 'An optimal HTTP cache stores and correctly serves multiple object variants when responses have different Vary response header values, depending on the value of request header(s)',
id: 'vary-dynamic',
kind: 'optional',
browser_skip: false,
depends_on: ['vary-invalidate'],
requests: [
{
request_headers: [
['v1', 'one'],
['v2', 'two'],
['ctrl', 'a']
],
mnot marked this conversation as resolved.
Show resolved Hide resolved
response_headers: [
['Expires', 5000],
['Last-Modified', -3000],
['Date', 0],
['Vary', 'v1, ctrl']
],
expected_type: 'not_cached',
setup: true
},
{
request_headers: [
['v1', 'one'],
['v2', 'two'],
['ctrl', 'b']
],
response_headers: [
['Expires', 5000],
['Last-Modified', -3000],
['Date', 0],
['Vary', 'v1, v2, ctrl']
],
expected_type: 'not_cached'
},
{
request_headers: [
['v1', 'one'],
['v2', 'two'],
['ctrl', 'b']
],
expected_type: 'cached',
setup: true
},
{
request_headers: [
['v1', 'one'],
['v2', 'two'],
['ctrl', 'a']
],
response_headers: [
['Expires', 5000],
['Last-Modified', -3000],
['Date', 0],
['Vary', 'v1, ctrl']
],
expected_type: 'cached'
},
]
},
{
name: 'An optimal HTTP cache should not include headers not listed in `Vary` in the cache key',
id: 'vary-cache-key',
Expand Down