api

http4k / org.http4k.core / Response

Response

interface Response : HttpMessage

Properties

Name Summary
status abstract val status: Status

Functions

Name Summary
body (Copy &) sets the body content.abstract fun body(body: Body): Response
abstract fun body(body: String): Response
abstract fun body(body: InputStream, length: Long?): Response
header (Copy &) Adds a header value with this name.abstract fun header(name: String, value: String?): Response
headers (Copy &) Add all passed headers.abstract fun headers(headers: Headers): Response
removeHeader (Copy &) remove headers with this name.abstract fun removeHeader(name: String): Response
replaceHeader (Copy &) Adds a header value with this name, replacing any previously set values.abstract fun replaceHeader(name: String, value: String?): Response
replaceHeaders Replace all headers with ones passed.abstract fun replaceHeaders(source: Headers): Response
status abstract fun status(new: Status): Response
toMessage Returns a formatted wire representation of this message.open fun toMessage(): String

Companion Object Functions

Name Summary
invoke operator fun invoke(status: Status, version: String = HTTP_1_1): Response

Extension Functions

Name Summary
alphabetiseHeaders fun <T : HttpMessage> T.alphabetiseHeaders(): T
asAzure fun Response.asAzure(request: HttpRequestMessage<Optional<String>>): HttpResponseMessage!
cookie fun Response.cookie(cookie: Cookie): Response
cookies fun Response.cookies(): List<Cookie>
invalidateCookie fun Response.invalidateCookie(name: String, domain: String? = null): Response
maxAge fun Response.maxAge(duration: Duration): Response
multipartIterator fun HttpMessage.multipartIterator(): Iterator<MultipartEntity>
mustRevalidate fun Response.mustRevalidate(): Response
noCache fun Response.noCache(): Response
noStore fun Response.noStore(): Response
onlyIfCached fun Response.onlyIfCached(): Response
private fun Response.private(): Response
public fun Response.public(): Response
removeCookie fun Response.removeCookie(name: String): Response
replaceCookie fun Response.replaceCookie(cookie: Cookie): Response
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
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
shouldHaveSetCookie infix fun Response.shouldHaveSetCookie(expected: Cookie): Unit
fun Response.shouldHaveSetCookie(name: String, match: Matcher<Cookie>): Unit
shouldHaveStatus infix fun Response.shouldHaveStatus(expected: Status): 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
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
shouldNotHaveSetCookie infix fun Response.shouldNotHaveSetCookie(expected: Cookie): Unit
fun Response.shouldNotHaveSetCookie(name: String, match: Matcher<Cookie>): Unit
shouldNotHaveStatus infix fun Response.shouldNotHaveStatus(expected: Status): Unit
staleIfError fun Response.staleIfError(duration: Duration): Response
staleWhileRevalidate fun Response.staleWhileRevalidate(duration: Duration): Response
transferTo fun Response.transferTo(destination: HttpServletResponse): Unit
with fun <T : HttpMessage> T.with(vararg modifiers: (T) -> T): T

Companion Object Extension Functions

Name Summary
parse fun Response.Companion.parse(response: String): Response

Inheritors

Name Summary
MemoryResponse data class MemoryResponse : Response
RoutedResponse class RoutedResponse : Response