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

# Request

`data class Request` (source)

The Request data class represents a resource request to be send by a Client.

It's API is inspired by the Request interface of the Web Fetch API: https://developer.mozilla.org/en-US/docs/Web/API/Request

### Types

Body | `class Body : Closeable` A Body to be send with the Request.
Method | `enum class Method` Request methods.
Redirect | `enum class Redirect`

### Constructors

<init> | `Request(url: String, method: Method = Method.GET, headers: MutableHeaders? = MutableHeaders(), connectTimeout: Pair<Long, TimeUnit>? = null, readTimeout: Pair<Long, TimeUnit>? = null, body: Body? = null, redirect: Redirect = Redirect.FOLLOW)` The Request data class represents a resource request to be send by a Client.

### Properties

body | `val body: Body?` An optional body to be send with the request.
connectTimeout | `val connectTimeout: Pair<Long, TimeUnit>?` A timeout to be used when connecting to the resource. If the timeout expires before the connection can be established, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout.
headers | `val headers: MutableHeaders?` Optional HTTP headers to be send with the request.
method | `val method: Method` The request method (GET, POST, ..)
readTimeout | `val readTimeout: Pair<Long, TimeUnit>?` A timeout to be used when reading from the resource. If the timeout expires before there is data available for read, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout.
redirect | `val redirect: Redirect` Whether the Client should follow redirects (HTTP 3xx) for this request or not.
url | `val url: String` The URL of the request.