MCPcopy Create free account
hub / github.com/async-library/react-async / parseResponse

Function parseResponse

packages/react-async/src/useAsync.tsx:249–255  ·  view source on GitHub ↗
(accept: undefined | string, json: undefined | boolean)

Source from the content-addressed store, hash-verified

247}
248
249const 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
257type OverrideParams = { resource?: RequestInfo } & Partial<RequestInit>
258

Callers 1

doFetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected