Package-level declarations

Types

Link copied to clipboard
data class Accept(val contentTypes: List<QualifiedContent>)

See https://www.rfc-editor.org/rfc/rfc9110.html#name-accept

Link copied to clipboard
interface Body : Closeable

If this Body is NOT being returned to the caller (via a Server implementation or otherwise), close() should be called.

Link copied to clipboard

BodyMode represents a choice between working lazily with streams or eagerly storing the body contents in memory.

Link copied to clipboard
data class ContentType(val value: String, val directives: Parameters = emptyList())
Link copied to clipboard
data class Credentials(val user: String, val password: String)
Link copied to clipboard
Link copied to clipboard
typealias Headers = Parameters
Link copied to clipboard
typealias HttpHandler = (request: Request) -> Response
Link copied to clipboard

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

Link copied to clipboard
data class HttpTransaction(val request: Request, val response: Response, val duration: Duration, val labels: Map<String, String> = defaultLabels(request, response), val start: Instant) : ProtocolTransaction<Response>
Link copied to clipboard
data class MemoryBody(val payload: ByteBuffer) : Body

Represents a body that is backed by an in-memory ByteBuffer. Closing this has no effect.

Link copied to clipboard
data class MemoryRequest(val method: Method, val uri: Uri, val headers: Headers = listOf(), val body: Body = EMPTY, val version: String = HTTP_1_1, val source: RequestSource? = null) : Request
Link copied to clipboard
data class MemoryResponse(val status: Status, val headers: Headers = listOf(), val body: Body = EMPTY, val version: String = HTTP_1_1) : Response
Link copied to clipboard
enum Method : Enum<Method>
Link copied to clipboard
class MimeTypes
Link copied to clipboard
typealias Parameters = List<Parameter>
Link copied to clipboard
Link copied to clipboard
data class QualifiedContent(val content: ContentType, val priority: Double = 1.0)
Link copied to clipboard
interface Request : HttpMessage
Link copied to clipboard
class RequestContext(val id: UUID = UUID.randomUUID())
Link copied to clipboard
class RequestContexts(storeId: String? = null) : Store<RequestContext>

In-memory RequestContext store. Override the storeId to use multiple stores in one app.

Link copied to clipboard
data class RequestSource(val address: String, val port: Int? = 0, val scheme: String? = null)
Link copied to clipboard
interface Response : HttpMessage
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class StreamBody(val stream: InputStream, val length: Long? = null) : Body

Represents a body that is backed by a (lazy) InputStream. Operating with StreamBody has a number of potential gotchas:

Link copied to clipboard
data class Uri(val scheme: String, val userInfo: String, val host: String, val port: Int?, val path: String, val query: String, val fragment: String) : Comparable<Uri>
Link copied to clipboard
data class UriTemplate
Link copied to clipboard
typealias UriValue = AbstractValue<Uri>

Custom values4k extensions.

Link copied to clipboard
open class UriValueFactory<DOMAIN : Value<Uri>>(fn: (Uri) -> DOMAIN, validation: Validation<Uri>? = null) : ValueFactory<DOMAIN, Uri>
Link copied to clipboard
data class WwwAuthenticate(val token: String, val contents: Map<String, String>) : Map<String, String>

Properties

Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
fun Uri.appendToPath(pathToAppend: String?): Uri
Link copied to clipboard
Link copied to clipboard
fun Uri.extend(uri: Uri): Uri
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <K, V> Map<K, List<V>>.getFirst(key: K): V?
Link copied to clipboard

This function works around input streams which report that there is nothing to read when they have never been accessed.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Request.Companion.parse(request: String, lineBreak: String = ""): Request
fun Response.Companion.parse(response: String, lineBreak: String = ""): Response
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Uri.query(name: String, value: String?): Uri
Link copied to clipboard
Link copied to clipboard
fun Uri.relative(relative: String): Uri
fun Uri.relative(relative: Uri): Uri
Link copied to clipboard
fun Uri.removeQueries(prefix: String = ""): Uri
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Request.toCurl(truncateBodyLength: Int = 256): String
Link copied to clipboard
fun String.toParameters(): List<Parameter>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : HttpMessage> T.with(vararg modifiers: (T) -> T): T
fun WebForm.with(vararg modifiers: (WebForm) -> WebForm): WebForm