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

Function getContentType

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

Source from the content-addressed store, hash-verified

77253 status: `${response.status}`,
77254 body
77255 };
77256}
77257function getRequestContentType(options = {}) {
77258 var _a5, _b2, _c2;
77259 return (_c2 = (_a5 = options.contentType) !== null && _a5 !== void 0 ? _a5 : (_b2 = options.headers) === null || _b2 === void 0 ? void 0 : _b2["content-type"]) !== null && _c2 !== void 0 ? _c2 : getContentType(options.body);
77260}
77261function getContentType(body) {
77262 if (ArrayBuffer.isView(body)) {
77263 return "application/octet-stream";
77264 }
77265 if (typeof body === "string") {
77266 try {
77267 JSON.parse(body);
77268 return "application/json; charset=UTF-8";
77269 } catch (error) {
77270 return void 0;
77271 }

Callers 1

getRequestContentTypeFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected