@booli/fetch-json
v1.6.5
Published
Fetch wrapper for json resorces
Keywords
Readme
Fetch Json
Wrapper around fetch to request json and geo json resources, including some general error handling.
Note that 204 responses will return an empty object {} instead of a body with no content, so
subsequent json parsing does not fail.
Required polyfills
fetchObject.assignPromise(indirectly needed as fetch polyfills require it)
Motivation
Most fetch requests expect json response and setting up request headers,checking response headers
and handling http errors involve some boilerplate, which is abstracted away by this package. Note
that unlike native fetch this wrapper will reject the returned promise if the response has an
error status code.
