android-components / mozilla.components.concept.fetch / Client


abstract class Client (source)

A generic Client for fetching resources via HTTP/s.

Abstract base class / interface for clients implementing the concept-fetch component.

The Request/Response API is inspired by the Web Fetch API:


Name Summary
<init> Client()
A generic Client for fetching resources via HTTP/s.


Name Summary
defaultHeaders val defaultHeaders: Headers
List of default headers that should be added to every request unless overridden by the headers in the request.


Name Summary
fetch abstract fun fetch(request: Request): Response
Starts the process of fetching a resource from the network as described by the Request object. This call is synchronous.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.
withInterceptors fun Client.withInterceptors(vararg interceptors: Interceptor): Client
Creates a new Client instance that will use the provided list of Interceptor instances.


Name Summary
GeckoViewFetchClient class GeckoViewFetchClient : Client
GeckoView (GeckoWebExecutor) based implementation of Client.
HttpURLConnectionClient class HttpURLConnectionClient : Client
HttpURLConnection implementation of Client.
OkHttpClient class OkHttpClient : Client
Client implementation using OkHttp.