Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val body: Body
Link copied to clipboard
abstract val headers: Headers
Link copied to clipboard
abstract val method: Method
Link copied to clipboard
abstract val source: RequestSource?
Link copied to clipboard
abstract val uri: Uri
Link copied to clipboard
abstract val version: String

Functions

Link copied to clipboard
Link copied to clipboard
fun Request.bearerAuth(token: String, scheme: String = "Bearer"): Request
Link copied to clipboard
Link copied to clipboard
abstract override fun body(body: String): Request
abstract override fun body(body: Body): Request
abstract override fun body(body: InputStream, length: Long?): Request

(Copy &) sets the body content.

Link copied to clipboard
open fun bodyString(): String

This will realise any underlying stream.

Link copied to clipboard
open override fun close()

Closes the request. For server generated messages, this is called by all backend/client implementations, but when consuming external responses in streaming mode, this should be used.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Request.form(vararg formData: Pair<String, String?>): Request
fun Request.form(name: String, value: String?): Request

fun Request.form(name: String): String?

Returns the first form parameter with name.

Link copied to clipboard
Link copied to clipboard
open fun header(name: String): String?

Retrieves the first header value with this name.

abstract override fun header(name: String, value: String?): Request

(Copy &) Adds a header value with this name.

Link copied to clipboard
abstract override fun headers(headers: Headers): Request

(Copy &) Add all passed headers.

Link copied to clipboard
open fun headerValues(name: String): List<String?>

Retrieves all header values with this name.

Link copied to clipboard
abstract fun method(method: Method): Request

(Copy &) sets the method.

Link copied to clipboard
fun Request.path(name: String): String?
Link copied to clipboard
abstract fun queries(name: String): List<String?>

Retrieves all query values with this name.

Link copied to clipboard
abstract fun query(name: String): String?

Retrieves the first query value with this name.

abstract fun query(name: String, value: String?): Request

(Copy &) Adds a query value with this name.

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

(Copy &) remove headers with this name.

Link copied to clipboard
abstract override fun removeHeaders(prefix: String): Request

(Copy &) remove headers with this prefix. Default removes all headers.

Link copied to clipboard
abstract fun removeQueries(prefix: String = ""): Request

(Copy &) remove queries with this prefix. Default removes all queries.

Link copied to clipboard
abstract fun removeQuery(name: String): Request

(Copy &) remove queries with this name.

Link copied to clipboard
abstract override fun replaceHeader(name: String, value: String?): Request

(Copy &) Adds a header value with this name, replacing any previously set values.

Link copied to clipboard
abstract override fun replaceHeaders(source: Headers): Request

Replace all headers with ones passed.

Link copied to clipboard
abstract fun source(source: RequestSource): Request

(Copy &) sets request source.

Link copied to clipboard
fun Request.toCurl(truncateBodyLength: Int = 256): String
Link copied to clipboard
open override fun toMessage(): String

Returns a formatted wire representation of this message.

Link copied to clipboard
abstract fun uri(uri: Uri): Request

(Copy &) sets the Uri.

Link copied to clipboard
fun Request.withBasicAuth(credentials: Credentials, header: String = "Authorization"): Request
Link copied to clipboard