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

Method parseResponse

packages/decap-cms-backend-gitea/src/API.ts:196–208  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

194 }
195
196 parseResponse(response: Response) {
197 const contentType = response.headers.get('Content-Type');
198 if (contentType && contentType.match(/json/)) {
199 return this.parseJsonResponse(response);
200 }
201 const textPromise = response.text().then(text => {
202 if (!response.ok) {
203 return Promise.reject(text);
204 }
205 return text;
206 });
207 return textPromise;
208 }
209
210 handleRequestError(error: FetchError, responseStatus: number) {
211 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