Skip to content

Commit bea115b

Browse files
committed
add SwR
Fixes #17.
1 parent 9ebf03a commit bea115b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/stale.mjs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,49 @@ export default {
5555
}
5656
]
5757
},
58+
{
59+
name: 'An optimal cache serves stale stored response with [`Cache-Control: stale-while-revalidate`](https://httpwg.org/specs/rfc5861.html).',
60+
id: 'stale-while-revalidate',
61+
kind: 'optimal',
62+
requests: [
63+
{
64+
setup: true,
65+
pause_after: true,
66+
response_headers: [
67+
['Cache-Control', 'max-age=1, stale-while-revalidate=3600'],
68+
['ETag', '"abc"']
69+
]
70+
},
71+
{
72+
expected_type: 'cached'
73+
}
74+
]
75+
},
76+
{
77+
name: 'HTTP cache must not serve stale stored response after the [`stale-while-revalidate`](https://httpwg.org/specs/rfc5861.html) window.',
78+
id: 'stale-while-revalidate-window',
79+
depends_on: ['stale-while-revalidate'],
80+
requests: [
81+
{
82+
setup: true,
83+
pause_after: true,
84+
response_headers: [
85+
['Cache-Control', 'max-age=1, stale-while-revalidate=4'],
86+
['ETag', '"abc"']
87+
]
88+
},
89+
{
90+
setup: true,
91+
pause_after: true,
92+
expected_type: 'cached'
93+
},
94+
{
95+
expected_response_headers: [
96+
['client-request-count', '3']
97+
]
98+
}
99+
]
100+
},
58101
{
59102
name: 'Does HTTP cache serve stale stored response when server sends `Cache-Control: stale-if-error` and subsequently closes the connection?',
60103
id: 'stale-sie-close',

0 commit comments

Comments
 (0)