fromFetch
Uses the Fetch API to make an HTTP request.
Parameters
input |
The resource you would like to fetch. Can be a url or a request object. |
init |
Optional. Default is A configuration object for the fetch. See MDN for more details |
Returns
Observable<Response>
: An Observable, that when subscribed to performs an HTTP request using the native fetch
function. The Subscription
is tied to an AbortController
for the the fetch.
Description
WARNING Parts of the fetch API are still experimental. AbortController
is
required for this implementation to work and use cancellation appropriately.
Will automatically set up an internal AbortController
in order to teardown the internal fetch
when the subscription tears down.
If a signal
is provided via the init
argument, it will behave like it usually does with
fetch
. If the provided signal
aborts, the error that fetch
normally rejects with
in that scenario will be emitted as an error from the observable.