-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathauthorization.mjs
110 lines (108 loc) · 3.02 KB
/
authorization.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import * as templates from './lib/templates.mjs'
export default
{
name: 'Storing Respones to Authenticated Requests',
id: 'auth',
description: 'These tests check for behaviours regarding authenticated HTTP responses.',
spec_anchors: ['caching.authenticated.responses'],
tests: [
{
name: 'HTTP shared cache must not reuse a response to a request that contained `Authorization`, even with explicit freshness',
id: 'other-authorization',
depends_on: ['freshness-max-age'],
browser_skip: true,
requests: [
templates.fresh({
request_headers: [
['Authorization', 'FOO']
],
expected_request_headers: [
['Authorization', 'FOO']
]
}),
{
expected_type: 'not_cached'
}
]
},
{
name: 'An optimal HTTP shared cache reuses a response to a request that contained `Authorization`, if it has `Cache-Control: public`',
id: 'other-authorization-public',
kind: 'optimal',
browser_skip: true,
depends_on: ['other-authorization'],
spec_anchors: ['cache-response-directive.public'],
requests: [
{
request_headers: [
['Authorization', 'FOO']
],
expected_request_headers: [
['Authorization', 'FOO']
],
response_headers: [
['Cache-Control', 'max-age=3600, public'],
['Date', 0]
],
pause_after: true,
setup: true
},
{
expected_type: 'cached'
}
]
},
{
name: 'An optimal HTTP shared cache reuses a response to a request that contained `Authorization`, if it has `Cache-Control: must-revalidate`',
id: 'other-authorization-must-revalidate',
kind: 'optimal',
browser_skip: true,
depends_on: ['other-authorization'],
requests: [
{
request_headers: [
['Authorization', 'FOO']
],
expected_request_headers: [
['Authorization', 'FOO']
],
response_headers: [
['Cache-Control', 'max-age=3600, must-revalidate'],
['Date', 0]
],
pause_after: true,
setup: true
},
{
expected_type: 'cached'
}
]
},
{
name: 'An optimal HTTP shared cache reuses a response to a request that contained `Authorization`, if it has `Cache-Control: s-maxage`',
id: 'other-authorization-smaxage',
kind: 'optimal',
browser_skip: true,
depends_on: ['other-authorization'],
requests: [
{
request_headers: [
['Authorization', 'FOO']
],
expected_request_headers: [
['Authorization', 'FOO']
],
response_headers: [
['Cache-Control', 's-maxage=3600'],
['Date', 0]
],
pause_after: true,
setup: true
},
{
expected_type: 'cached'
}
]
}
]
}