-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathinterim.mjs
124 lines (123 loc) · 3.17 KB
/
interim.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
export default
{
name: 'Interim Response Handling',
id: 'interim',
description: 'These tests check how caches handle interim responses.',
tests: [
{
name: 'An optimal HTTP cache passes a 102 response through and caches the final response',
id: 'interim-102',
browser_skip: true, // Fetch API in browsers don't expose interim responses
kind: 'optimal',
requests: [
{
interim_responses: [[102]],
expected_interim_responses: [[102]],
response_headers: [
['Cache-Control', 'max-age=100000'],
['Date', 0]
],
pause_after: true
},
{
expected_type: 'cached'
}
]
},
{
name: 'An optimal HTTP cache passes a 103 response through and caches the final response',
id: 'interim-103',
browser_skip: true,
kind: 'optimal',
requests: [
{
interim_responses: [
[103, [
['link', '</styles.css>; rel=preload; as=style'],
['x-my-header', 'test']
]]
],
expected_interim_responses: [
[103, [
['link', '</styles.css>; rel=preload; as=style'],
['x-my-header', 'test']
]]
],
response_headers: [
['Cache-Control', 'max-age=100000'],
['Date', 0]
],
pause_after: true
},
{
expected_type: 'cached'
}
]
},
{
name: 'An HTTP cache should not cache non-final responses',
id: 'interim-not-cached',
browser_skip: true,
kind: 'required',
requests: [
{
interim_responses: [
[103, [
['link', '</styles.css>; rel=preload; as=style']
]]
],
expected_interim_responses: [
[103, [
['link', '</styles.css>; rel=preload; as=style']
]]
],
response_headers: [
['Cache-Control', 'max-age=100000'],
['Date', 0]
],
pause_after: true
},
{
expected_type: 'cached',
expected_interim_responses: []
}
]
},
{
name: 'An optimal HTTP cache should not store headers from non-final responses',
id: 'interim-no-header-reuse',
browser_skip: true,
kind: 'optimal',
requests: [
{
interim_responses: [
[103, [
['link', '</styles.css>; rel=preload; as=style'],
['x-my-header', 'test']
]]
],
expected_interim_responses: [
[103, [
['link', '</styles.css>; rel=preload; as=style'],
['x-my-header', 'test']
]]
],
response_headers: [
['Cache-Control', 'max-age=100000'],
['Date', 0]
],
expected_response_headers_missing: [
'x-my-header'
],
pause_after: true
},
{
expected_type: 'cached',
expected_response_headers_missing: [
'x-my-header'
]
}
]
}
]
}