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

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: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

Constructors

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

Properties

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.

Functions

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.

Inheritors

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.