Builder

open class Builder

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun addHeader(name: String, value: String): Request.Builder

Adds a header with name and value. Prefer this method for multiply-valued headers like "Cookie".

Link copied to clipboard
open fun build(): Request
Link copied to clipboard
open fun cacheControl(cacheControl: CacheControl): Request.Builder

Sets this request's Cache-Control header, replacing any cache control headers already present. If cacheControl doesn't define any directives, this clears this request's cache-control headers.

Link copied to clipboard
fun cacheUrlOverride(cacheUrlOverride: HttpUrl?): Request.Builder

Override the Request.url for caching, if it is either polluted with transient query params, or has a canonical URL possibly for a CDN.

Link copied to clipboard
open fun delete(body: RequestBody? = RequestBody.EMPTY): Request.Builder
Link copied to clipboard
open fun get(): Request.Builder
Link copied to clipboard

Configures this request's body to be compressed when it is transmitted. This also adds the 'Content-Encoding: gzip' header.

Link copied to clipboard
open fun head(): Request.Builder
Link copied to clipboard
open fun header(name: String, value: String): Request.Builder

Sets the header named name to value. If this request already has any headers with that name, they are all replaced.

Link copied to clipboard
open fun headers(headers: Headers): Request.Builder

Removes all headers on this builder and adds headers.

Link copied to clipboard
open fun method(method: String, body: RequestBody?): Request.Builder
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Removes all headers named name on this builder.

Link copied to clipboard
inline fun <T : Any> tag(tag: T?): Request.Builder

Attaches tag to the request using T as a key. Tags can be read from a request using Request.tag. Use null to remove any existing tag assigned for T.

open fun tag(tag: Any?): Request.Builder

Attaches tag to the request using Object.class as a key.

open fun <T> tag(type: <Error class: unknown class><in T>, tag: T?): <Error class: unknown class>
fun <T : Any> tag(type: KClass<T>, tag: T?): Request.Builder

Attaches tag to the request using type as a key. Tags can be read from a request using Request.tag. Use null to remove any existing tag assigned for type.

Link copied to clipboard
open fun url(url: <Error class: unknown class>): <Error class: unknown class>
open fun url(url: String): Request.Builder

Sets the URL target of this request.

open fun url(url: HttpUrl): Request.Builder