api

http4k / org.http4k.core / MemoryRequest

MemoryRequest

data class MemoryRequest : Request

Constructors

Name Summary
<init> MemoryRequest(method: Method, uri: Uri, headers: Headers = listOf(), body: Body = EMPTY, version: String = HTTP_1_1, source: RequestSource? = null)

Properties

Name Summary
body val body: Body
headers val headers: Headers
method val method: Method
source val source: RequestSource?
uri val uri: Uri
version val version: String

Functions

Name Summary
body (Copy &) sets the body content.fun body(body: Body): MemoryRequest
fun body(body: String): MemoryRequest
fun body(body: InputStream, length: Long?): MemoryRequest
equals fun equals(other: Any?): Boolean
header (Copy &) Adds a header value with this name.fun header(name: String, value: String?): MemoryRequest
headers (Copy &) Add all passed headers.fun headers(headers: Headers): MemoryRequest
method (Copy &) sets the method.fun method(method: Method): Request
queries Retrieves all query values with this name.fun queries(name: String): List<String?>
query (Copy &) Adds a query value with this name.fun query(name: String, value: String?): MemoryRequest
Retrieves the first query value with this name.fun query(name: String): String?
removeHeader (Copy &) remove headers with this name.fun removeHeader(name: String): MemoryRequest
removeQuery (Copy &) remove queries with this name.fun removeQuery(name: String): MemoryRequest
replaceHeader (Copy &) Adds a header value with this name, replacing any previously set values.fun replaceHeader(name: String, value: String?): MemoryRequest
replaceHeaders Replace all headers with ones passed.fun replaceHeaders(source: Headers): MemoryRequest
source (Copy &) sets request source.fun source(source: RequestSource): MemoryRequest
toString fun toString(): String
uri (Copy &) sets the Uri.fun uri(uri: Uri): MemoryRequest

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
shouldHaveBody infix fun HttpMessage.shouldHaveBody(expected: Matcher<Body>): Unit
infix fun HttpMessage.shouldHaveBody(expected: Matcher<String?>): Unit
infix fun HttpMessage.shouldHaveBody(expected: String): Unit
infix fun HttpMessage.shouldHaveBody(expected: Regex): Unit
fun <T> HttpMessage.shouldHaveBody(lens: BodyLens<T>, matcher: Matcher<T>): Unit
shouldHaveContentType infix fun HttpMessage.shouldHaveContentType(expected: ContentType): Unit
shouldHaveCookie infix fun Request.shouldHaveCookie(expected: Cookie): Unit
fun Request.shouldHaveCookie(name: String, expected: Regex): Unit
fun Request.shouldHaveCookie(name: String, expected: String): Unit
fun Request.shouldHaveCookie(name: String, match: Matcher<Cookie>): Unit
shouldHaveForm fun Request.shouldHaveForm(name: String, matcher: Matcher<String?>): Unit
fun Request.shouldHaveForm(name: String, matcher: Regex): Unit
fun Request.shouldHaveForm(name: String, expected: CharSequence): Unit
shouldHaveHeader fun <T> HttpMessage.shouldHaveHeader(lens: HeaderLens<T>, matcher: Matcher<T>): Unit
fun HttpMessage.shouldHaveHeader(name: String, matcher: Matcher<String>): Unit
fun HttpMessage.shouldHaveHeader(name: String, expected: String): Unit
fun HttpMessage.shouldHaveHeader(name: String, expected: Regex): Unit
infix fun HttpMessage.shouldHaveHeader(name: String): Unit
fun HttpMessage.shouldHaveHeader(name: String, expected: List<String?>): Unit
shouldHaveMethod infix fun Request.shouldHaveMethod(expected: Method): Unit
shouldHaveQuery fun <T> Request.shouldHaveQuery(lens: QueryLens<T>, matcher: Matcher<T>): Unit
fun Request.shouldHaveQuery(name: String, matcher: Matcher<String?>): Unit
fun Request.shouldHaveQuery(name: String, expected: CharSequence): Unit
fun Request.shouldHaveQuery(name: String, expected: Regex): Unit
fun Request.shouldHaveQuery(name: String, expected: List<String?>): Unit
shouldHaveUri infix fun Request.shouldHaveUri(expected: Regex): Unit
infix fun Request.shouldHaveUri(expected: Uri): Unit
infix fun Request.shouldHaveUri(expected: String): Unit
infix fun Request.shouldHaveUri(match: Matcher<Uri>): Unit
shouldNotHaveBody infix fun HttpMessage.shouldNotHaveBody(expected: Matcher<Body>): Unit
infix fun HttpMessage.shouldNotHaveBody(expected: Matcher<String?>): Unit
infix fun HttpMessage.shouldNotHaveBody(expected: String): Unit
infix fun HttpMessage.shouldNotHaveBody(expected: Regex): Unit
fun <T> HttpMessage.shouldNotHaveBody(lens: BodyLens<T>, matcher: Matcher<T>): Unit
shouldNotHaveContentType infix fun HttpMessage.shouldNotHaveContentType(expected: ContentType): Unit
shouldNotHaveCookie infix fun Request.shouldNotHaveCookie(expected: Cookie): Unit
fun Request.shouldNotHaveCookie(name: String, expected: Regex): Unit
fun Request.shouldNotHaveCookie(name: String, expected: String): Unit
fun Request.shouldNotHaveCookie(name: String, match: Matcher<Cookie>): Unit
shouldNotHaveForm fun Request.shouldNotHaveForm(name: String, matcher: Matcher<String?>): Unit
fun Request.shouldNotHaveForm(name: String, matcher: Regex): Unit
fun Request.shouldNotHaveForm(name: String, expected: CharSequence): Unit
shouldNotHaveHeader fun <T> HttpMessage.shouldNotHaveHeader(lens: HeaderLens<T>, matcher: Matcher<T>): Unit
fun HttpMessage.shouldNotHaveHeader(name: String, matcher: Matcher<String>): Unit
fun HttpMessage.shouldNotHaveHeader(name: String, expected: String): Unit
fun HttpMessage.shouldNotHaveHeader(name: String, expected: Regex): Unit
infix fun HttpMessage.shouldNotHaveHeader(name: String): Unit
fun HttpMessage.shouldNotHaveHeader(name: String, expected: List<String?>): Unit
shouldNotHaveMethod infix fun Request.shouldNotHaveMethod(expected: Method): Unit
shouldNotHaveQuery fun <T> Request.shouldNotHaveQuery(lens: QueryLens<T>, matcher: Matcher<T>): Unit
fun Request.shouldNotHaveQuery(name: String, matcher: Matcher<String?>): Unit
fun Request.shouldNotHaveQuery(name: String, expected: CharSequence): Unit
fun Request.shouldNotHaveQuery(name: String, expected: Regex): Unit
fun Request.shouldNotHaveQuery(name: String, expected: List<String?>): Unit
shouldNotHaveUri infix fun Request.shouldNotHaveUri(expected: Regex): Unit
infix fun Request.shouldNotHaveUri(expected: Uri): Unit
infix fun Request.shouldNotHaveUri(expected: String): Unit
infix fun Request.shouldNotHaveUri(match: Matcher<Uri>): Unit
toCurl fun Request.toCurl(truncateBodyLength: Int = 256): String
with fun <T : HttpMessage> T.with(vararg modifiers: (T) -> T): T