(response: Response)
| 49 | } |
| 50 | |
| 51 | export function parseResponse(response: Response) { |
| 52 | const contentType = response.headers.get('Content-Type'); |
| 53 | if (contentType && contentType.match(/json/)) { |
| 54 | return parseJsonResponse(response); |
| 55 | } |
| 56 | const textPromise = response.text().then(text => { |
| 57 | if (!response.ok) return Promise.reject(text); |
| 58 | return text; |
| 59 | }); |
| 60 | return textPromise; |
| 61 | } |
| 62 | |
| 63 | export async function requestWithBackoff( |
| 64 | api: API, |
no test coverage detected