Skip to content

Instantly share code, notes, and snippets.

@jamesplease
Last active April 4, 2018 17:39
Show Gist options
  • Save jamesplease/9c5bb2070b0beb457430835d120530ae to your computer and use it in GitHub Desktop.
Save jamesplease/9c5bb2070b0beb457430835d120530ae to your computer and use it in GitHub Desktop.
Possible piece of an API for a fetch wrapper
{
// The response was received, and the data is currently streaming.
// Note: this can be `true` even when the request fails (if the body of
// the error is being streamed)
streaming: <Boolean>,
// The response has not yet been returned by the server, OR it has been
// returned and the headers are still streaming (it appears that the headers)
// are immediately available at the same time that the Response object is
// made available to you)
awaiting: <Boolean>,
// The response succeeded. Equal to (!error && res.ok)
succeeded: <Boolean>,
// The response failed for some reason. The opposite of `succeeded`. This
// includes network errors as well as error status codes.
// Equal to (error || !res.ok)
failed: <Boolean>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment