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

Function defaultParseResponse2

out/cli.cjs:80471–80496  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

80469 return kind3 === "a" ? f4.call(receiver, value) : f4 ? f4.value = value : state2.set(receiver, value), value;
80470};
80471var __classPrivateFieldGet8 = function(receiver, state2, kind3, f4) {
80472 if (kind3 === "a" && !f4) throw new TypeError("Private accessor was defined without a getter");
80473 if (typeof state2 === "function" ? receiver !== state2 || !f4 : !state2.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
80474 return kind3 === "m" ? f4 : kind3 === "a" ? f4.call(receiver) : f4 ? f4.value : state2.get(receiver);
80475};
80476var _AbstractPage_client2;
80477async function defaultParseResponse2(props) {
80478 const { response } = props;
80479 if (props.options.stream) {
80480 debug4("response", response.status, response.url, response.headers, response.body);
80481 if (props.options.__streamClass) {
80482 return props.options.__streamClass.fromSSEResponse(response, props.controller);
80483 }
80484 return Stream2.fromSSEResponse(response, props.controller);
80485 }
80486 if (response.status === 204) {
80487 return null;
80488 }
80489 if (props.options.__binaryResponse) {
80490 return response;
80491 }
80492 const contentType = response.headers.get("content-type");
80493 const isJSON = contentType?.includes("application/json") || contentType?.includes("application/vnd.api+json");
80494 if (isJSON) {
80495 const json = await response.json();
80496 debug4("response", response.status, response.url, response.headers, json);
80497 return json;
80498 }
80499 const text = await response.text();

Callers 1

constructorMethod · 0.85

Calls 6

debug4Function · 0.85
fromSSEResponseMethod · 0.80
includesMethod · 0.80
getMethod · 0.45
jsonMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…