MCPcopy
hub / github.com/di-sukharev/opencommit / getBodyLength

Function getBodyLength

out/cli.cjs:73638–73661  ·  view source on GitHub ↗
(body)

Source from the content-addressed store, hash-verified

73636};
73637isFetchSupported && ((res) => {
73638 ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type2) => {
73639 !resolvers[type2] && (resolvers[type2] = utils_default.isFunction(res[type2]) ? (res2) => res2[type2]() : (_7, config8) => {
73640 throw new AxiosError_default(`Response type '${type2}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config8);
73641 });
73642 });
73643})(new Response());
73644var getBodyLength = async (body) => {
73645 if (body == null) {
73646 return 0;
73647 }
73648 if (utils_default.isBlob(body)) {
73649 return body.size;
73650 }
73651 if (utils_default.isSpecCompliantForm(body)) {
73652 const _request = new Request(platform_default.origin, {
73653 method: "POST",
73654 body
73655 });
73656 return (await _request.arrayBuffer()).byteLength;
73657 }
73658 if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
73659 return body.byteLength;
73660 }
73661 if (utils_default.isURLSearchParams(body)) {
73662 body = body + "";
73663 }
73664 if (utils_default.isString(body)) {

Callers 1

resolveBodyLengthFunction · 0.85

Calls 1

arrayBufferMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…