HttpClient
class HttpClient(adapter: HttpClientPort, val settings: HttpClientSettings = HttpClientSettings()) : Closeable
Client to use other REST services.
TODO Add support for client filters. I.e.: for auth, signing, etc.
Constructors
Link copied to clipboard
constructor(adapter: HttpClientPort, baseUrl: URL, settings: HttpClientSettings = HttpClientSettings())
constructor(adapter: HttpClientPort, baseUrl: String, settings: HttpClientSettings = HttpClientSettings())
Functions
Link copied to clipboard
Link copied to clipboard
fun delete(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType): HttpClientResponse
Link copied to clipboard
fun get(path: String = "", headers: Headers = Headers(), body: Any? = null, contentType: ContentType? = settings.contentType): HttpClientResponse
Link copied to clipboard
Link copied to clipboard
fun options(path: String = "", body: Any? = null, headers: Headers = Headers(), contentType: ContentType? = settings.contentType): HttpClientResponse
Link copied to clipboard
fun patch(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType): HttpClientResponse
Link copied to clipboard
fun post(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType): HttpClientResponse
Link copied to clipboard
fun put(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType): HttpClientResponse
Link copied to clipboard
Synchronous execution.
Link copied to clipboard
Link copied to clipboard
fun trace(path: String = "", body: Any? = null, contentType: ContentType? = settings.contentType): HttpClientResponse
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: WsCloseStatus, reason: String) -> Unit = { _, _ -> }): WsSession