(request, response)
| 257 | } |
| 258 | |
| 259 | async put (request, response) { |
| 260 | webidl.brandCheck(this, Cache) |
| 261 | |
| 262 | const prefix = 'Cache.put' |
| 263 | webidl.argumentLengthCheck(arguments, 2, prefix) |
| 264 | |
| 265 | request = webidl.converters.RequestInfo(request) |
| 266 | response = webidl.converters.Response(response, prefix, 'response') |
| 267 | |
| 268 | // 1. |
| 269 | let innerRequest = null |
| 270 | |
| 271 | // 2. |
| 272 | if (webidl.is.Request(request)) { |
| 273 | innerRequest = getRequestState(request) |
| 274 | } else { // 3. |
| 275 | innerRequest = getRequestState(new Request(request)) |
| 276 | } |
| 277 | |
| 278 | // 4. |
| 279 | if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== 'GET') { |
| 280 | throw webidl.errors.exception({ |
| 281 | header: prefix, |
| 282 | message: 'Expected an http/s scheme when method is not GET' |
| 283 | }) |
| 284 | } |
| 285 | |
| 286 | // 5. |
| 287 | const innerResponse = getResponseState(response) |
| 288 | |
| 289 | // 6. |
| 290 | if (innerResponse.status === 206) { |
| 291 | throw webidl.errors.exception({ |
| 292 | header: prefix, |
| 293 | message: 'Got 206 status' |
| 294 | }) |
| 295 | } |
| 296 | |
| 297 | // 7. |
| 298 | if (innerResponse.headersList.contains('vary')) { |
| 299 | // 7.1. |
| 300 | const fieldValues = getFieldValues(innerResponse.headersList.get('vary')) |
| 301 | |
| 302 | // 7.2. |
| 303 | for (const fieldValue of fieldValues) { |
| 304 | // 7.2.1 |
| 305 | if (fieldValue === '*') { |
| 306 | throw webidl.errors.exception({ |
| 307 | header: prefix, |
| 308 | message: 'Got * vary field value' |
| 309 | }) |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | // 8. |
| 315 | if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) { |
| 316 | throw webidl.errors.exception({ |
nothing calls this directly
no test coverage detected