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

Method parseResponse

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

Source from the content-addressed store, hash-verified

320 }
321
322 parseResponse(response: Response) {
323 const contentType = response.headers.get('Content-Type');
324 if (contentType && contentType.match(/json/)) {
325 return this.parseJsonResponse(response);
326 }
327 const textPromise = response.text().then(text => {
328 if (!response.ok) {
329 return Promise.reject(text);
330 }
331 return text;
332 });
333 return textPromise;
334 }
335
336 handleRequestError(error: FetchError, responseStatus: number) {
337 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