Skip to content

Commit a2471ba

Browse files
author
Neil Craig
committed
Add vary-dynamic test
1 parent 8ad420a commit a2471ba

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

tests/vary.mjs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,72 @@ export default {
8080
}
8181
]
8282
},
83+
{
84+
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',
85+
id: 'vary-dynamic',
86+
kind: 'optional',
87+
browser_skip: true,
88+
requests: [
89+
{
90+
request_headers: [
91+
['v1', 'one'],
92+
['v2', 'two'],
93+
['ctrl', 'a']
94+
],
95+
response_headers: [
96+
['Expires', 5000],
97+
['Last-Modified', -3000],
98+
['Date', 0],
99+
['Vary', 'v1, ctrl']
100+
],
101+
expected_type: 'not_cached'
102+
},
103+
{
104+
request_headers: [
105+
['v1', 'one'],
106+
['v2', 'two'],
107+
['ctrl', 'a']
108+
],
109+
expected_type: 'cached'
110+
},
111+
{
112+
request_headers: [
113+
['v1', 'one'],
114+
['v2', 'two'],
115+
['ctrl', 'b']
116+
],
117+
response_headers: [
118+
['Expires', 5000],
119+
['Last-Modified', -3000],
120+
['Date', 0],
121+
['Vary', 'v1, v2, ctrl']
122+
],
123+
expected_type: 'not_cached'
124+
},
125+
{
126+
request_headers: [
127+
['v1', 'one'],
128+
['v2', 'two'],
129+
['ctrl', 'b']
130+
],
131+
expected_type: 'cached'
132+
},
133+
{
134+
request_headers: [
135+
['v1', 'one'],
136+
['v2', 'two'],
137+
['ctrl', 'a']
138+
],
139+
response_headers: [
140+
['Expires', 5000],
141+
['Last-Modified', -3000],
142+
['Date', 0],
143+
['Vary', 'v1, ctrl']
144+
],
145+
expected_type: 'cached'
146+
},
147+
]
148+
},
83149
{
84150
name: 'An optimal HTTP cache should not include headers not listed in `Vary` in the cache key',
85151
id: 'vary-cache-key',

0 commit comments

Comments
 (0)