MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / getRequestBody

Function getRequestBody

out/cli.cjs:77293–77318  ·  view source on GitHub ↗
(body, contentType = "")

Source from the content-addressed store, hash-verified

77291 abortSignal: options.abortSignal,
77292 onUploadProgress: options.onUploadProgress,
77293 onDownloadProgress: options.onDownloadProgress,
77294 timeout: options.timeout,
77295 enableBrowserStreams: true,
77296 streamResponseStatusCodes: options.responseAsStream ? /* @__PURE__ */ new Set([Number.POSITIVE_INFINITY]) : void 0
77297 });
77298}
77299function getRequestBody(body, contentType = "") {
77300 if (body === void 0) {
77301 return { body: void 0 };
77302 }
77303 if (isReadableStream3(body)) {
77304 return { body };
77305 }
77306 const firstType = contentType.split(";")[0];
77307 if (firstType === "application/json") {
77308 return { body: JSON.stringify(body) };
77309 }
77310 if (ArrayBuffer.isView(body)) {
77311 return { body: body instanceof Uint8Array ? body : JSON.stringify(body) };
77312 }
77313 switch (firstType) {
77314 case "multipart/form-data":
77315 return isRLCFormDataInput(body) ? { formData: processFormData(body) } : { body: JSON.stringify(body) };
77316 case "text/plain":
77317 return { body: String(body) };
77318 default:
77319 if (typeof body === "string") {
77320 return { body };
77321 }

Callers 1

buildPipelineRequestFunction · 0.85

Calls 3

isReadableStream3Function · 0.85
isRLCFormDataInputFunction · 0.85
processFormDataFunction · 0.85

Tested by

no test coverage detected