()
| 5813 | return new Uint8Array(bytes).buffer; |
| 5814 | }, instance); |
| 5815 | }, |
| 5816 | text() { |
| 5817 | return consumeBody(this, utf8DecodeBytes, instance); |
| 5818 | }, |
| 5819 | json() { |
| 5820 | return consumeBody(this, parseJSONFromBytes, instance); |
| 5821 | }, |
| 5822 | formData() { |
| 5823 | return consumeBody(this, (value) => { |
| 5824 | const mimeType = bodyMimeType(this); |
| 5825 | if (mimeType !== null) { |
| 5826 | switch (mimeType.essence) { |
| 5827 | case "multipart/form-data": { |
| 5828 | const parsed = multipartFormDataParser(value, mimeType); |
| 5829 | if (parsed === "failure") { |
| 5830 | throw new TypeError("Failed to parse body as FormData."); |
| 5831 | } |
| 5832 | const fd = new FormData(); |
| 5833 | fd[kState] = parsed; |
| 5834 | return fd; |
| 5835 | } |
| 5836 | case "application/x-www-form-urlencoded": { |
| 5837 | const entries = new URLSearchParams(value.toString()); |
| 5838 | const fd = new FormData(); |
| 5839 | for (const [name, value2] of entries) { |
| 5840 | fd.append(name, value2); |
| 5841 | } |
| 5842 | return fd; |
| 5843 | } |
| 5844 | } |
| 5845 | } |
| 5846 | throw new TypeError( |
nothing calls this directly
no test coverage detected