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