(_0, _1)
| 15946 | }); |
| 15947 | } |
| 15948 | put(_0, _1) { |
| 15949 | return __async(this, arguments, function* (request, response) { |
| 15950 | webidl.brandCheck(this, _Cache); |
| 15951 | const prefix = "Cache.put"; |
| 15952 | webidl.argumentLengthCheck(arguments, 2, prefix); |
| 15953 | request = webidl.converters.RequestInfo(request, prefix, "request"); |
| 15954 | response = webidl.converters.Response(response, prefix, "response"); |
| 15955 | let innerRequest = null; |
| 15956 | if (request instanceof Request) { |
| 15957 | innerRequest = request[kState]; |
| 15958 | } else { |
| 15959 | innerRequest = new Request(request)[kState]; |
| 15960 | } |
| 15961 | if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") { |
| 15962 | throw webidl.errors.exception({ |
| 15963 | header: prefix, |
| 15964 | message: "Expected an http/s scheme when method is not GET" |
| 15965 | }); |
| 15966 | } |
| 15967 | const innerResponse = response[kState]; |
| 15968 | if (innerResponse.status === 206) { |
| 15969 | throw webidl.errors.exception({ |
| 15970 | header: prefix, |
| 15971 | message: "Got 206 status" |
| 15972 | }); |
| 15973 | } |
| 15974 | if (innerResponse.headersList.contains("vary")) { |
| 15975 | const fieldValues = getFieldValues(innerResponse.headersList.get("vary")); |
| 15976 | for (const fieldValue of fieldValues) { |
| 15977 | if (fieldValue === "*") { |
| 15978 | throw webidl.errors.exception({ |
| 15979 | header: prefix, |
| 15980 | message: "Got * vary field value" |
| 15981 | }); |
| 15982 | } |
| 15983 | } |
| 15984 | } |
| 15985 | if (innerResponse.body && (isDisturbed(innerResponse.body.stream) || innerResponse.body.stream.locked)) { |
| 15986 | throw webidl.errors.exception({ |
| 15987 | header: prefix, |
| 15988 | message: "Response body is locked or disturbed" |
| 15989 | }); |
| 15990 | } |
| 15991 | const clonedResponse = cloneResponse(innerResponse); |
| 15992 | const bodyReadPromise = createDeferredPromise(); |
| 15993 | if (innerResponse.body != null) { |
| 15994 | const stream = innerResponse.body.stream; |
| 15995 | const reader = stream.getReader(); |
| 15996 | readAllBytes(reader).then(bodyReadPromise.resolve, bodyReadPromise.reject); |
| 15997 | } else { |
| 15998 | bodyReadPromise.resolve(void 0); |
| 15999 | } |
| 16000 | const operations = []; |
| 16001 | const operation = { |
| 16002 | type: "put", |
| 16003 | // 14. |
| 16004 | request: innerRequest, |
| 16005 | // 15. |
nothing calls this directly
no test coverage detected