Builder

abstract class Builder

A builder to create and configure a Request instance.

Since

200.2.0

Functions

Link copied to clipboard

Adds a Request.Header to the request. Existing headers with the same name will not be overridden.

abstract fun addHeader(name: String, value: String): Request.Builder

Adds a Request.Header with the specified name and value to the request. Existing headers with the same name will not be overridden.

Link copied to clipboard

Adds multiple Request.Headers to the request. Existing headers with the same name will not be overridden.

Link copied to clipboard

Adds a Request.Parameter to the request. For GET requests, the parameter will be appended to the end of the URL as a query parameter. For POST requests, the parameter will be added to the request's form body.

abstract fun addParameter(name: String, value: String): Request.Builder

Adds a request parameter with the given name and value to the request. For GET requests, the parameter will be appended to the end of the URL as a query parameter. For POST requests, the parameter will be added to the request's form body.

Link copied to clipboard

Adds multiple Request.Parameters to the request. For GET requests, the parameters will be appended to the end of the URL as query parameters. For POST requests, the parameters will be added to the request's form body.

Link copied to clipboard
abstract fun build(): Request

Create a new Request instance.

Link copied to clipboard
abstract fun head(): Request.Builder

Sets the request method to Method.Head.

Link copied to clipboard
abstract fun post(): Request.Builder

Sets the request method to Method.Post.

abstract fun post(name: String, filename: String, data: ByteArray, contentType: String? = null): Request.Builder

Creates a multipart POST request with the given parameters, representing the data of the request's body part.

Link copied to clipboard
abstract fun removeHeader(name: String): Request.Builder

Removes any headers with the specified name on this builder.

Link copied to clipboard

Removes any parameters with the specified name on this builder.

Link copied to clipboard
abstract fun setHeader(name: String, value: String): Request.Builder

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

Link copied to clipboard
abstract fun url(url: String): Request.Builder

Sets the url of the request.