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 1 commit
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
66 changes: 66 additions & 0 deletions tests/vary.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,72 @@ export default {
}
]
},
{
name: 'An optimal HTTP cache stores and correctly serves multiple object variants when the `Vary` response header value depends on one or more request header values',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be better stated as:

"... when responses have different Vary response header values, depending on multiple request headers?"

id: 'vary-dynamic',
kind: 'optional',
browser_skip: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory this could apply to browsers too; it's just that they don't currently store more than one variant.

You could filter for that by making it 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'
},
{
request_headers: [
['v1', 'one'],
['v2', 'two'],
['ctrl', 'a']
],
expected_type: 'cached'
},
{
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'
},
{
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