MCPcopy Create free account
hub / github.com/decaporg/decap-cms / parseResponse

Function parseResponse

packages/decap-cms-lib-util/src/API.ts:51–61  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

49}
50
51export function parseResponse(response: Response) {
52 const contentType = response.headers.get('Content-Type');
53 if (contentType && contentType.match(/json/)) {
54 return parseJsonResponse(response);
55 }
56 const textPromise = response.text().then(text => {
57 if (!response.ok) return Promise.reject(text);
58 return text;
59 });
60 return textPromise;
61}
62
63export async function requestWithBackoff(
64 api: API,

Callers 1

apiRequestFunction · 0.70

Calls 2

parseJsonResponseFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected