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

Method parseResponse

packages/decap-cms-backend-forgejo/src/API.ts:222–234  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

220 }
221
222 parseResponse(response: Response) {
223 const contentType = response.headers.get('Content-Type');
224 if (contentType && contentType.match(/json/)) {
225 return this.parseJsonResponse(response);
226 }
227 const textPromise = response.text().then(text => {
228 if (!response.ok) {
229 return Promise.reject(text);
230 }
231 return text;
232 });
233 return textPromise;
234 }
235
236 handleRequestError(error: FetchError, responseStatus: number) {
237 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