(input)
| 51541 | const nextTwoBytes = String.fromCharCode(input[i3 + 1], input[i3 + 2]); |
| 51542 | const bytePoint = Number.parseInt(nextTwoBytes, 16); |
| 51543 | output.push(bytePoint); |
| 51544 | i3 += 2; |
| 51545 | } |
| 51546 | } |
| 51547 | return Uint8Array.from(output); |
| 51548 | } |
| 51549 | function parseMIMEType(input) { |
| 51550 | input = removeHTTPWhitespace(input, true, true); |
| 51551 | const position = { position: 0 }; |
| 51552 | const type2 = collectASequenceOfCodePointsFast( |
| 51553 | "/", |
| 51554 | input, |
| 51555 | position |
| 51556 | ); |
| 51557 | if (type2.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(type2)) { |
| 51558 | return "failure"; |
| 51559 | } |
| 51560 | if (position.position > input.length) { |
| 51561 | return "failure"; |
| 51562 | } |
| 51563 | position.position++; |
| 51564 | let subtype = collectASequenceOfCodePointsFast( |
| 51565 | ";", |
| 51566 | input, |
| 51567 | position |
| 51568 | ); |
| 51569 | subtype = removeHTTPWhitespace(subtype, false, true); |
| 51570 | if (subtype.length === 0 || !HTTP_TOKEN_CODEPOINTS.test(subtype)) { |
| 51571 | return "failure"; |
| 51572 | } |
| 51573 | const typeLowercase = type2.toLowerCase(); |
| 51574 | const subtypeLowercase = subtype.toLowerCase(); |
| 51575 | const mimeType = { |
| 51576 | type: typeLowercase, |
| 51577 | subtype: subtypeLowercase, |
| 51578 | /** @type {Map<string, string>} */ |
| 51579 | parameters: /* @__PURE__ */ new Map(), |
| 51580 | // https://mimesniff.spec.whatwg.org/#mime-type-essence |
| 51581 | essence: `${typeLowercase}/${subtypeLowercase}` |
| 51582 | }; |
| 51583 | while (position.position < input.length) { |
| 51584 | position.position++; |
| 51585 | collectASequenceOfCodePoints( |
| 51586 | // https://fetch.spec.whatwg.org/#http-whitespace |
| 51587 | (char) => HTTP_WHITESPACE_REGEX.test(char), |
| 51588 | input, |
| 51589 | position |
| 51590 | ); |
| 51591 | let parameterName = collectASequenceOfCodePoints( |
| 51592 | (char) => char !== ";" && char !== "=", |
| 51593 | input, |
| 51594 | position |
| 51595 | ); |
| 51596 | parameterName = parameterName.toLowerCase(); |
| 51597 | if (position.position < input.length) { |
| 51598 | if (input[position.position] === ";") { |
| 51599 | continue; |
| 51600 | } |
no test coverage detected
searching dependent graphs…