MCPcopy Create free account
hub / github.com/angular/dev-infra / consumeBody

Function consumeBody

github-actions/saucelabs/set-saucelabs-env.js:5855–5878  ·  view source on GitHub ↗
(object, convertBytesToJSValue, instance)

Source from the content-addressed store, hash-verified

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 }

Callers 6

blobFunction · 0.70
arrayBufferFunction · 0.70
textFunction · 0.70
jsonFunction · 0.70
formDataFunction · 0.70
bytesFunction · 0.70

Calls 6

__asyncFunction · 0.70
bodyUnusableFunction · 0.70
throwIfAbortedFunction · 0.70
createDeferredPromiseFunction · 0.70
successStepsFunction · 0.70
fullyReadBodyFunction · 0.70

Tested by

no test coverage detected