Skip to content

Instantly share code, notes, and snippets.

@marksb
Created May 18, 2018 14:06
Show Gist options
  • Save marksb/31151164c9b71399288675d7a8017027 to your computer and use it in GitHub Desktop.
Save marksb/31151164c9b71399288675d7a8017027 to your computer and use it in GitHub Desktop.
#### Why fetch (from `core/utils/fetch`)?
This was originally created to add and extract headers to the requests for authentication purposes. When we moved to the middleware approach it seems that this is just a wrapper around `whatwg-fetch`. As a note - this wrapper isn't really necessary anymore.
#### Why `parseResponse`?
This was created, in part, due to API issues. Since `500` errors were occuring and responding with `text/html` content type, it was causing errors when we were trying to parse the response.
#### Why `apiMiddlware`?
We moved to `apiMiddleware` to replace the `fetch` from `core/utils`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment