| 3489 | if (mimeType.startsWith(";")) { |
| 3490 | mimeType = "text/plain" + mimeType; |
| 3491 | } |
| 3492 | let mimeTypeRecord = parseMIMEType(mimeType); |
| 3493 | if (mimeTypeRecord === "failure") { |
| 3494 | mimeTypeRecord = parseMIMEType("text/plain;charset=US-ASCII"); |
| 3495 | } |
| 3496 | return { mimeType: mimeTypeRecord, body }; |
| 3497 | } |
| 3498 | function URLSerializer(url, excludeFragment = false) { |
| 3499 | if (!excludeFragment) { |
| 3500 | return url.href; |
| 3501 | } |
| 3502 | const href = url.href; |
| 3503 | const hashLength = url.hash.length; |
| 3504 | const serialized = hashLength === 0 ? href : href.substring(0, href.length - hashLength); |
| 3505 | if (!hashLength && href.endsWith("#")) { |