Skip to content

Commit

Permalink
add SwR
Browse files Browse the repository at this point in the history
Fixes #17.
  • Loading branch information
mnot committed Jul 12, 2023
1 parent 9ebf03a commit bea115b
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/stale.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,49 @@ export default {
}
]
},
{
name: 'An optimal cache serves stale stored response with [`Cache-Control: stale-while-revalidate`](https://httpwg.org/specs/rfc5861.html).',
id: 'stale-while-revalidate',
kind: 'optimal',
requests: [
{
setup: true,
pause_after: true,
response_headers: [
['Cache-Control', 'max-age=1, stale-while-revalidate=3600'],
['ETag', '"abc"']
]
},
{
expected_type: 'cached'
}
]
},
{
name: 'HTTP cache must not serve stale stored response after the [`stale-while-revalidate`](https://httpwg.org/specs/rfc5861.html) window.',
id: 'stale-while-revalidate-window',
depends_on: ['stale-while-revalidate'],
requests: [
{
setup: true,
pause_after: true,
response_headers: [
['Cache-Control', 'max-age=1, stale-while-revalidate=4'],
['ETag', '"abc"']
]
},
{
setup: true,
pause_after: true,
expected_type: 'cached'
},
{
expected_response_headers: [
['client-request-count', '3']
]
}
]
},
{
name: 'Does HTTP cache serve stale stored response when server sends `Cache-Control: stale-if-error` and subsequently closes the connection?',
id: 'stale-sie-close',
Expand Down

0 comments on commit bea115b

Please sign in to comment.