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 field 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, returning the response body as a raw array of bytes.
Call POST on a target resource, returning the response body as a raw array of bytes.
Call PUT on a target resource, returning the response body as a raw array of bytes.
Like deleteBytes, but returns null if the request failed for any reason.
Like getBytes, but returns null if the request failed for any reason.
Like headBytes, but returns null if the request failed for any reason.
Like options, but returns null if the request failed for any reason.
Like optionsBytes, but returns null if the request failed for any reason.
Like patchBytes, but returns null if the request failed for any reason.
Like postBytes, but returns null if the request failed for any reason.
Like putBytes, but returns null if the request failed for any reason.