Function
parseResponse
(accept: undefined | string, json: undefined | boolean)
Source from the content-addressed store, hash-verified
| 247 | } |
| 248 | |
| 249 | const parseResponse = (accept: undefined | string, json: undefined | boolean) => ( |
| 250 | res: Response |
| 251 | ) => { |
| 252 | if (!res.ok) return Promise.reject(new FetchError(res)) |
| 253 | if (typeof json === "boolean") return json ? res.json() : res |
| 254 | return accept === "application/json" ? res.json() : res |
| 255 | } |
| 256 | |
| 257 | type OverrideParams = { resource?: RequestInfo } & Partial<RequestInit> |
| 258 | |
Tested by
no test coverage detected