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

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

### Properties

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

### Functions

fetch | `abstract fun fetch(request: Request): Response` Starts the process of fetching a resource from the network as described by the Request object.

### Inheritors

HttpURLConnectionClient | `class HttpURLConnectionClient : Client` HttpURLConnection implementation of Client.
OkHttpClient | `class OkHttpClient : Client` Client implementation using OkHttp.