http4k / org.http4k.core / Request


interface Request : HttpMessage


Name Summary
method abstract val method: Method
source abstract val source: RequestSource?
uri abstract val uri: Uri


Name Summary
body (Copy &) sets the body content.abstract fun body(body: Body): Request
abstract fun body(body: String): Request
abstract fun body(body: InputStream, length: Long?): Request
header (Copy &) Adds a header value with this name.abstract fun header(name: String, value: String?): Request
headers (Copy &) Add all passed headers.abstract fun headers(headers: Headers): Request
method (Copy &) sets the method.abstract fun method(method: Method): Request
queries Retrieves all query values with this name.abstract fun queries(name: String): List<String?>
query (Copy &) Adds a query value with this name.abstract fun query(name: String, value: String?): Request
Retrieves the first query value with this name.abstract fun query(name: String): String?
removeHeader (Copy &) remove headers with this name.abstract fun removeHeader(name: String): Request
removeQuery (Copy &) remove queries with this name.abstract fun removeQuery(name: String): Request
replaceHeader (Copy &) Adds a header value with this name, replacing any previously set values.abstract fun replaceHeader(name: String, value: String?): Request
replaceHeaders Replace all headers with ones passed.abstract fun replaceHeaders(source: Headers): Request
source (Copy &) sets request source.abstract fun source(source: RequestSource): Request
toMessage Returns a formatted wire representation of this message.open fun toMessage(): String
uri (Copy &) sets the Uri.abstract fun uri(uri: Uri): Request

Companion Object Functions

Name Summary
invoke operator fun invoke(method: Method, uri: Uri, version: String = HTTP_1_1): Request
operator fun invoke(method: Method, uri: String, version: String = HTTP_1_1): Request
operator fun invoke(method: Method, template: UriTemplate, version: String = HTTP_1_1): Request

Extension Functions

Name Summary
alphabetiseHeaders fun <T : HttpMessage> T.alphabetiseHeaders(): T
cookie fun Request.cookie(name: String, value: String): Request
fun Request.cookie(new: Cookie): Request
fun Request.cookie(name: String): Cookie?
cookies fun Request.cookies(): List<Cookie>
form Returns the first form parameter with name.fun Request.form(name: String): String?fun Request.form(): Form
fun Request.form(name: String, value: String): Request
formAsMap fun Request.formAsMap(): Map<String, List<String?>>
fragmentParameter Retrieves the first fragment parameter value with this name.fun Request.fragmentParameter(name: String): String?
(Copy &) Adds a query value with this name.fun Request.fragmentParameter(name: String, value: String?): Request
fragmentParameters Retrieves all fragment parameters with this name.fun Request.fragmentParameters(name: String): List<String?>
multipartIterator fun HttpMessage.multipartIterator(): Iterator<MultipartEntity>
path fun Request.path(name: String): String?
removeCookie fun Request.removeCookie(name: String): Request
toCurl fun Request.toCurl(truncateBodyLength: Int = 256): String
with fun <T : HttpMessage> T.with(vararg modifiers: (T) -> T): T

Companion Object Extension Functions

Name Summary
parse fun Request.Companion.parse(request: String): Request


Name Summary
MemoryRequest data class MemoryRequest : Request
RoutedRequest data class RoutedRequest : Request