-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathpragma.mjs
97 lines (95 loc) · 2.58 KB
/
pragma.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
import * as templates from './lib/templates.mjs'
export default
{
name: 'Pragma',
id: 'pragma',
description: 'These tests check how caches handle the deprecated `Pragma` header in reqeusts and responses. Note that This field is deprecated - it is not required to be supported.',
spec_anchors: ['field.pragma'],
tests: [
{
name: 'Does HTTP cache use a stored fresh response when request contains `Pragma: no-cache`?',
id: 'pragma-request-no-cache',
kind: 'check',
depends_on: ['freshness-max-age'],
requests: [
templates.fresh({}),
{
request_headers: [
['Pragma', 'no-cache']
],
expected_type: 'cached'
}
]
},
{
name: 'Does HTTP cache reuse a stored fresh response when request contains `Pragma: unrecognised-extension`?',
id: 'pragma-request-extension',
kind: 'check',
depends_on: ['freshness-max-age'],
requests: [
templates.fresh({}),
{
request_headers: [
['Pragma', 'unrecognised-extension']
],
expected_type: 'cached'
}
]
},
{
name: 'Does HTTP cache reuse a stored and otherwise fresh response when it contains `Pragma: no-cache`?',
id: 'pragma-response-no-cache',
kind: 'check',
depends_on: ['freshness-max-age'],
requests: [
{
response_headers: [
['Cache-Control', 'max-age=3600'],
['Pragma', 'no-cache']
],
setup: true
},
{
expected_type: 'cached'
}
]
},
{
name: 'Does HTTP cache reuse a stored and heuristically fresh response when it contains `Pragma: no-cache`?',
id: 'pragma-response-no-cache-heuristic',
kind: 'check',
depends_on: ['heuristic-200-cached'],
requests: [
{
response_headers: [
['Date', 0],
['Last-Modified', -10000],
['Pragma', 'no-cache']
],
setup: true
},
{
expected_type: 'cached'
}
]
},
{
name: 'Does HTTP cache use a stored and otherwise fresh response when it contains `Pragma: unrecognised-extension`?',
id: 'pragma-response-extension',
kind: 'check',
depends_on: ['freshness-max-age'],
requests: [
{
response_headers: [
['Cache-Control', 'max-age=3600'],
['Pragma', 'unrecognised-extension']
],
setup: true
},
{
expected_type: 'cached'
}
]
}
]
}