request
inline fun request(uri: String, method: HttpMethod, f: CustomHttpRequestBuilder.() -> Unit = {}): HttpRequest
Creates an HTTP request of the given method type to the specified URL.
Return
The created HTTP request.
Example usage:
val request = method("https://example.com", HttpMethod.Post) {
stringBody("Hello, world!")
}
val response: HttpResponse<String> = request.coSend(ofString)
Content copied to clipboard
Parameters
uri
The URI of the request.
method
The HttpMethod of the request.
f
A lambda with receiver on CustomHttpRequestBuilder
which allows to build the HTTP request.
inline fun request(uri: URI, method: HttpMethod, f: CustomHttpRequestBuilder.() -> Unit = {}): HttpRequest
Creates an HTTP request of the given method type to the specified URL.
Return
The created HTTP request.
Example usage:
val request = method(URI("https://example.com"), HttpMethod.Post) {
stringBody("Hello, world!")
}
val response: HttpResponse<String> = request.coSend(ofString)
Content copied to clipboard
Parameters
uri
The URI of the request.
method
The HttpMethod of the request.
f
A lambda with receiver on CustomHttpRequestBuilder
which allows to build the HTTP request.