WowHttp

class WowHttp(val base: URI, timeout: Duration = Duration.ofSeconds(30)) : AutoCloseable

A JSON client of a server's port at base, over HTTP/1.1: each call answers with the status, headers and body the server gave, waiting at most timeout for it.

Constructors

Link copied to clipboard
constructor(base: URI, timeout: Duration = Duration.ofSeconds(30))

Properties

Link copied to clipboard
val base: URI

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun get(path: String, headers: Map<String, String> = emptyMap(), caller: Caller? = null): Answer

GET path with headers, as caller when one is given.

Link copied to clipboard
fun post(path: String, json: String? = "{}", headers: Map<String, String> = emptyMap(), caller: Caller? = null): Answer

POST json to path with headers, as caller when one is given; an empty object by default.

Link copied to clipboard
fun request(method: String, path: String, json: String? = null, headers: Map<String, String> = emptyMap(), caller: Caller? = null): Answer

method path with headers, sending json as application/json when it is not null. A caller goes as the development identity headers (DevelopmentHeaders.of, as UserCredential.DEVELOPMENT writes them), which headers of the same name override.