OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>HTTP Cache - Invalidation</title> |
| 6 <meta name="help" href="https://fetch.spec.whatwg.org/#request"> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="/common/utils.js"></script> |
| 10 <script src="/common/get-host-info.sub.js"></script> |
| 11 <script src="http-cache.js"></script> |
| 12 </head> |
| 13 <body> |
| 14 <script> |
| 15 var tests = [ |
| 16 { |
| 17 name: 'HTTP cache invalidates after a successful response from a POST', |
| 18 requests: [ |
| 19 { |
| 20 template: "fresh" |
| 21 }, { |
| 22 request_method: "POST", |
| 23 request_body: "abc", |
| 24 }, { |
| 25 expected_type: "not_cached" |
| 26 } |
| 27 ] |
| 28 }, |
| 29 { |
| 30 name: 'HTTP cache does not invalidate after a failed response from an un
safe request', |
| 31 requests: [ |
| 32 { |
| 33 template: "fresh" |
| 34 }, { |
| 35 request_method: "POST", |
| 36 request_body: "abc", |
| 37 response_status: [500, "Internal Server Error"] |
| 38 }, { |
| 39 expected_type: "cached" |
| 40 } |
| 41 ] |
| 42 }, |
| 43 { |
| 44 name: 'HTTP cache invalidates after a successful response from a PUT', |
| 45 requests: [ |
| 46 { |
| 47 template: "fresh" |
| 48 }, { |
| 49 template: "fresh", |
| 50 request_method: "PUT", |
| 51 request_body: "abc", |
| 52 }, { |
| 53 expected_type: "not_cached" |
| 54 } |
| 55 ] |
| 56 }, |
| 57 { |
| 58 name: 'HTTP cache invalidates after a successful response from a DELETE'
, |
| 59 requests: [ |
| 60 { |
| 61 template: "fresh" |
| 62 }, { |
| 63 request_method: "DELETE", |
| 64 request_body: "abc", |
| 65 }, { |
| 66 expected_type: "not_cached" |
| 67 } |
| 68 ] |
| 69 }, |
| 70 { |
| 71 name: 'HTTP cache invalidates after a successful response from an unknow
n method', |
| 72 requests: [ |
| 73 { |
| 74 template: "fresh" |
| 75 }, { |
| 76 request_method: "FOO", |
| 77 request_body: "abc", |
| 78 }, { |
| 79 expected_type: "not_cached" |
| 80 } |
| 81 ] |
| 82 }, |
| 83 |
| 84 |
| 85 { |
| 86 name: 'HTTP cache invalidates Location URL after a successful response f
rom a POST', |
| 87 requests: [ |
| 88 { |
| 89 template: "location" |
| 90 }, { |
| 91 request_method: "POST", |
| 92 request_body: "abc", |
| 93 template: "lcl_response" |
| 94 }, { |
| 95 template: "location", |
| 96 expected_type: "not_cached" |
| 97 } |
| 98 ] |
| 99 }, |
| 100 { |
| 101 name: 'HTTP cache does not invalidate Location URL after a failed respon
se from an unsafe request', |
| 102 requests: [ |
| 103 { |
| 104 template: "location" |
| 105 }, { |
| 106 template: "lcl_response", |
| 107 request_method: "POST", |
| 108 request_body: "abc", |
| 109 response_status: [500, "Internal Server Error"] |
| 110 }, { |
| 111 template: "location", |
| 112 expected_type: "cached" |
| 113 } |
| 114 ] |
| 115 }, |
| 116 { |
| 117 name: 'HTTP cache invalidates Location URL after a successful response f
rom a PUT', |
| 118 requests: [ |
| 119 { |
| 120 template: "location" |
| 121 }, { |
| 122 template: "lcl_response", |
| 123 request_method: "PUT", |
| 124 request_body: "abc", |
| 125 }, { |
| 126 template: "location", |
| 127 expected_type: "not_cached" |
| 128 } |
| 129 ] |
| 130 }, |
| 131 { |
| 132 name: 'HTTP cache invalidates Location URL after a successful response f
rom a DELETE', |
| 133 requests: [ |
| 134 { |
| 135 template: "location" |
| 136 }, { |
| 137 template: "lcl_response", |
| 138 request_method: "DELETE", |
| 139 request_body: "abc", |
| 140 }, { |
| 141 template: "location", |
| 142 expected_type: "not_cached" |
| 143 } |
| 144 ] |
| 145 }, |
| 146 { |
| 147 name: 'HTTP cache invalidates Location URL after a successful response f
rom an unknown method', |
| 148 requests: [ |
| 149 { |
| 150 template: "location" |
| 151 }, { |
| 152 template: "lcl_response", |
| 153 request_method: "FOO", |
| 154 request_body: "abc", |
| 155 }, { |
| 156 template: "location", |
| 157 expected_type: "not_cached" |
| 158 } |
| 159 ] |
| 160 }, |
| 161 |
| 162 |
| 163 |
| 164 { |
| 165 name: 'HTTP cache invalidates Content-Location URL after a successful re
sponse from a POST', |
| 166 requests: [ |
| 167 { |
| 168 template: "content_location" |
| 169 }, { |
| 170 request_method: "POST", |
| 171 request_body: "abc", |
| 172 template: "lcl_response" |
| 173 }, { |
| 174 template: "content_location", |
| 175 expected_type: "not_cached" |
| 176 } |
| 177 ] |
| 178 }, |
| 179 { |
| 180 name: 'HTTP cache does not invalidate Content-Location URL after a faile
d response from an unsafe request', |
| 181 requests: [ |
| 182 { |
| 183 template: "content_location" |
| 184 }, { |
| 185 template: "lcl_response", |
| 186 request_method: "POST", |
| 187 request_body: "abc", |
| 188 response_status: [500, "Internal Server Error"] |
| 189 }, { |
| 190 template: "content_location", |
| 191 expected_type: "cached" |
| 192 } |
| 193 ] |
| 194 }, |
| 195 { |
| 196 name: 'HTTP cache invalidates Content-Location URL after a successful re
sponse from a PUT', |
| 197 requests: [ |
| 198 { |
| 199 template: "content_location" |
| 200 }, { |
| 201 template: "lcl_response", |
| 202 request_method: "PUT", |
| 203 request_body: "abc", |
| 204 }, { |
| 205 template: "content_location", |
| 206 expected_type: "not_cached" |
| 207 } |
| 208 ] |
| 209 }, |
| 210 { |
| 211 name: 'HTTP cache invalidates Content-Location URL after a successful re
sponse from a DELETE', |
| 212 requests: [ |
| 213 { |
| 214 template: "content_location" |
| 215 }, { |
| 216 template: "lcl_response", |
| 217 request_method: "DELETE", |
| 218 request_body: "abc", |
| 219 }, { |
| 220 template: "content_location", |
| 221 expected_type: "not_cached" |
| 222 } |
| 223 ] |
| 224 }, |
| 225 { |
| 226 name: 'HTTP cache invalidates Content-Location URL after a successful re
sponse from an unknown method', |
| 227 requests: [ |
| 228 { |
| 229 template: "content_location" |
| 230 }, { |
| 231 template: "lcl_response", |
| 232 request_method: "FOO", |
| 233 request_body: "abc", |
| 234 }, { |
| 235 template: "content_location", |
| 236 expected_type: "not_cached" |
| 237 } |
| 238 ] |
| 239 } |
| 240 |
| 241 ]; |
| 242 run_tests(tests); |
| 243 </script> |
| 244 </body> |
| 245 </html> |
OLD | NEW |