HttpFetcher
A class with a slightly friendlier API than using Window.fetch directly by providing HTTP method helper methods.
For example:
// Without HttpFetcher
window.fetch(HttpMethod.GET, "/some/api/path")
// With HttpFetcher
window.http.get("/some/api/path")
// ... or a version that won't throw exceptions
// window.http.tryGet("/some/api/path")The class additionally exposes a logOnError property which globally applies to all try... methods.
Properties
Functions
Call DELETE on a target resource, returning the response body as a raw array of bytes.
Call OPTIONS on a target resource, returning the response body as a raw array of bytes.
Call PATCH on a target resource.
Call PATCH on a target resource, returning the response body as a raw array of bytes.
Call POST on a target resource.
Call POST on a target resource, returning the response body as a raw array of bytes.
Call PUT on a target resource.
Call PUT on a target resource, returning the response body as a raw array of bytes.
Like delete, but returns null instead of throwing if the request fails.
Like deleteBytes, but returns null instead of throwing if the request fails or its body can't be read.
Like get, but returns null instead of throwing if the request fails.
Like getBytes, but returns null instead of throwing if the request fails or its body can't be read.
Like head, but returns null instead of throwing if the request fails.
Like options, but returns null instead of throwing if the request fails.
Like optionsBytes, but returns null instead of throwing if the request fails or its body can't be read.
Like patch, but returns null instead of throwing if the request fails.
Like patchBytes, but returns null instead of throwing if the request fails or its body can't be read.
Like post, but returns null instead of throwing if the request fails.
Like postBytes, but returns null instead of throwing if the request fails or its body can't be read.
Like put, but returns null instead of throwing if the request fails.
Like putBytes, but returns null instead of throwing if the request fails or its body can't be read.