(response, pattern)
| 33532 | exports2.HTTPClient = HTTPClient; |
| 33533 | var mediaParamSeparator = /\s*;\s*/g; |
| 33534 | function matchContentType(response, pattern) { |
| 33535 | var _a5; |
| 33536 | if (pattern === "*") { |
| 33537 | return true; |
| 33538 | } |
| 33539 | let contentType = ((_a5 = response.headers.get("content-type")) === null || _a5 === void 0 ? void 0 : _a5.trim()) || "application/octet-stream"; |
| 33540 | contentType = contentType.toLowerCase(); |
| 33541 | const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator); |
| 33542 | const [wantType = "", ...wantParams] = wantParts; |
| 33543 | if (wantType.split("/").length !== 2) { |
| 33544 | return false; |
| 33545 | } |
| 33546 | const gotParts = contentType.split(mediaParamSeparator); |
| 33547 | const [gotType = "", ...gotParams] = gotParts; |
| 33548 | const [type2 = "", subtype = ""] = gotType.split("/"); |
| 33549 | if (!type2 || !subtype) { |
| 33550 | return false; |
| 33551 | } |
| 33552 | if (wantType !== "*/*" && gotType !== wantType && `${type2}/*` !== wantType && `*/${subtype}` !== wantType) { |
| 33553 | return false; |
| 33554 | } |
| 33555 | if (gotParams.length < wantParams.length) { |
| 33556 | return false; |
| 33557 | } |
| 33558 | const params = new Set(gotParams); |
| 33559 | for (const wantParam of wantParams) { |
| 33560 | if (!params.has(wantParam)) { |
| 33561 | return false; |
| 33562 | } |
| 33563 | } |
| 33564 | return true; |
| 33565 | } |
| 33566 | var codeRangeRE = new RegExp("^[0-9]xx$", "i"); |
| 33567 | function matchStatusCode(response, codes) { |
| 33568 | const actual = `${response.status}`; |
no test coverage detected
searching dependent graphs…