(response: Response)
| 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); |
no test coverage detected