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")
Content copied to clipboard
The class additionally exposes a logOnError
field which globally applies to all try...
methods.
Properties
Functions
Link copied to clipboard
Link copied to clipboard
suspend fun tryOptions(resource: String, headers: Map<String, Any>? = FetchDefaults.Headers, redirect: RequestRedirect? = FetchDefaults.Redirect, abortController: AbortController? = null): ByteArray?
Like options, but returns null if the request failed for any reason.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard