(object, convertBytesToJSValue, instance)
| 5853 | return new Uint8Array(bytes); |
| 5854 | }, instance); |
| 5855 | } |
| 5856 | }; |
| 5857 | return methods; |
| 5858 | } |
| 5859 | function mixinBody(prototype) { |
| 5860 | Object.assign(prototype.prototype, bodyMixinMethods(prototype)); |
| 5861 | } |
| 5862 | function consumeBody(object, convertBytesToJSValue, instance) { |
| 5863 | return __async(this, null, function* () { |
| 5864 | webidl.brandCheck(object, instance); |
| 5865 | if (bodyUnusable(object)) { |
| 5866 | throw new TypeError("Body is unusable: Body has already been read"); |
| 5867 | } |
| 5868 | throwIfAborted(object[kState]); |
| 5869 | const promise = createDeferredPromise(); |
| 5870 | const errorSteps = (error) => promise.reject(error); |
| 5871 | const successSteps = (data) => { |
| 5872 | try { |
| 5873 | promise.resolve(convertBytesToJSValue(data)); |
| 5874 | } catch (e) { |
| 5875 | errorSteps(e); |
| 5876 | } |
| 5877 | }; |
| 5878 | if (object[kState].body == null) { |
| 5879 | successSteps(Buffer.allocUnsafe(0)); |
| 5880 | return promise.promise; |
| 5881 | } |
no test coverage detected