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

Function consumeBody

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

Source from the content-addressed store, hash-verified

5853 }
5854 function cloneBody(instance, body) {
5855 const [out1, out2] = body.stream.tee();
5856 body.stream = out1;
5857 return {
5858 stream: out2,
5859 length: body.length,
5860 source: body.source
5861 };
5862 }
5863 function throwIfAborted(state) {
5864 if (state.aborted) {
5865 throw new DOMException("The operation was aborted.", "AbortError");
5866 }
5867 }
5868 function bodyMixinMethods(instance) {
5869 const methods = {
5870 blob() {
5871 return consumeBody(this, (bytes) => {
5872 let mimeType = bodyMimeType(this);
5873 if (mimeType === null) {
5874 mimeType = "";
5875 } else if (mimeType) {
5876 mimeType = serializeAMimeType(mimeType);
5877 }
5878 return new Blob2([bytes], { type: mimeType });
5879 }, instance);
5880 },
5881 arrayBuffer() {

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