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

Method parseResponse

packages/decap-cms-backend-github/src/API.ts:347–359  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

345 }
346
347 parseResponse(response: Response) {
348 const contentType = response.headers.get('Content-Type');
349 if (contentType && contentType.match(/json/)) {
350 return this.parseJsonResponse(response);
351 }
352 const textPromise = response.text().then(text => {
353 if (!response.ok) {
354 return Promise.reject(text);
355 }
356 return text;
357 });
358 return textPromise;
359 }
360
361 handleRequestError(error: FetchError, responseStatus: number) {
362 throw new APIError(error.message, responseStatus, API_NAME);

Callers 2

requestMethod · 0.95
requestAllPagesMethod · 0.95

Calls 2

parseJsonResponseMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected