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

Function wrapRequestBody

github-actions/saucelabs/set-saucelabs-env.js:1179–1200  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

1177 }
1178 };
1179 function wrapRequestBody(body) {
1180 if (isStream(body)) {
1181 if (bodyLength(body) === 0) {
1182 body.on("data", function() {
1183 assert(false);
1184 });
1185 }
1186 if (typeof body.readableDidRead !== "boolean") {
1187 body[kBodyUsed] = false;
1188 EE.prototype.on.call(body, "data", function() {
1189 this[kBodyUsed] = true;
1190 });
1191 }
1192 return body;
1193 } else if (body && typeof body.pipeTo === "function") {
1194 return new BodyAsyncIterable(body);
1195 } else if (body && typeof body !== "string" && !ArrayBuffer.isView(body) && isIterable(body)) {
1196 return new BodyAsyncIterable(body);
1197 } else {
1198 return body;
1199 }
1200 }
1201 function nop() {
1202 }
1203 function isStream(obj) {

Callers 1

constructorMethod · 0.70

Calls 4

isStreamFunction · 0.70
bodyLengthFunction · 0.70
isIterableFunction · 0.70
onMethod · 0.45

Tested by

no test coverage detected