HttpClient

class HttpClient(adapter: HttpClientPort, val settings: HttpClientSettings = HttpClientSettings(), val handler: HttpHandler? = null) : Closeable

Client to use other REST services.

Constructors

Link copied to clipboard
constructor(adapter: HttpClientPort, settings: HttpClientSettings = HttpClientSettings(), handler: HttpHandler? = null)

Properties

Link copied to clipboard
var cookies: List<Cookie>
Link copied to clipboard
val handler: HttpHandler? = null
Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun cookiesMap(): Map<String, Cookie>
Link copied to clipboard
fun delete(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun get(path: String = "", headers: Headers = Headers(), body: Any? = null, contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun head(path: String = "", headers: Headers = Headers()): HttpResponsePort
Link copied to clipboard
fun options(path: String = "", body: Any? = null, headers: Headers = Headers(), contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun patch(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun post(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun put(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun request(block: HttpClient.() -> Unit)
Link copied to clipboard
fun send(request: HttpRequest, attributes: Map<String, Any> = emptyMap()): HttpResponsePort

Synchronous execution.

Link copied to clipboard
fun sse(request: HttpRequest): Flow.Publisher<ServerEvent>
fun sse(path: String): Flow.Publisher<ServerEvent>
Link copied to clipboard
fun start()
Link copied to clipboard
fun started(): Boolean
Link copied to clipboard
fun stop()
Link copied to clipboard
fun trace(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType, accept: List<ContentType> = settings.accept): HttpResponsePort
Link copied to clipboard
fun ws(path: String, onConnect: WsSession.() -> Unit = {}, onBinary: WsSession.(data: ByteArray) -> Unit = {}, onText: WsSession.(text: String) -> Unit = {}, onPing: WsSession.(data: ByteArray) -> Unit = {}, onPong: WsSession.(data: ByteArray) -> Unit = {}, onClose: WsSession.(status: Int, reason: String) -> Unit = { _, _ -> }): WsSession