HttpMessage

HttpMessages are designed to be immutable, so any mutation methods return a modified copy of the message.

Inheritors

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 version: String

Functions

Link copied to clipboard
abstract fun body(body: String): HttpMessage
abstract fun body(body: Body): HttpMessage
abstract fun body(body: InputStream, length: Long? = null): HttpMessage

(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
open fun header(name: String): String?

Retrieves the first header value with this name.

abstract fun header(name: String, value: String?): HttpMessage

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

Link copied to clipboard
abstract fun headers(headers: Headers): HttpMessage

(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 removeHeader(name: String): HttpMessage

(Copy &) remove headers with this name.

Link copied to clipboard
abstract fun removeHeaders(prefix: String = ""): HttpMessage

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

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

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

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

Replace all headers with ones passed.

Link copied to clipboard
abstract fun toMessage(): String

Returns a formatted wire representation of this message.