CustomHttpRequestBuilder

class CustomHttpRequestBuilder(method: HttpMethod, other: HttpRequest.Builder = newBuilder().method(method.name, noBody())) : HttpRequest.Builder

A class that builds HTTP requests with custom features like query parameters and authorization.

Constructors

Link copied to clipboard
constructor(method: HttpMethod, other: HttpRequest.Builder = newBuilder().method(method.name, noBody()))

Functions

Link copied to clipboard
fun accept(value: String): HttpRequest.Builder

Sets the Accept of the HTTP request.

Link copied to clipboard
inline fun authorization(f: Authorization.Companion.() -> Authorization): HttpRequest.Builder

Adds an authorization to the HTTP request.

Link copied to clipboard
fun body(body: HttpRequest.BodyPublisher): HttpRequest.Builder

Sets the body of the HTTP request.

Link copied to clipboard
open override fun build(): HttpRequest
Link copied to clipboard
fun byteArrayBody(value: ByteArray): HttpRequest.Builder

Sets the body of the HTTP request as a ByteArray.

Link copied to clipboard
fun contentType(value: String): HttpRequest.Builder

Sets the Content-Type of the HTTP request.

Link copied to clipboard
open override fun copy(): HttpRequest.Builder
Link copied to clipboard
open override fun DELETE(): HttpRequest.Builder
Link copied to clipboard
open override fun expectContinue(p0: Boolean): HttpRequest.Builder
Link copied to clipboard
fun flowBody(value: Flow<ByteBuffer>, contentLength: Long? = null): HttpRequest.Builder

Sets the body of the HTTP request as a Flow.

Link copied to clipboard
open override fun GET(): HttpRequest.Builder
Link copied to clipboard
open override fun header(p0: String, p1: String): HttpRequest.Builder
Link copied to clipboard
open override fun headers(vararg p0: String): HttpRequest.Builder
Link copied to clipboard
open override fun method(p0: String, p1: HttpRequest.BodyPublisher): HttpRequest.Builder
Link copied to clipboard
open override fun POST(p0: HttpRequest.BodyPublisher): HttpRequest.Builder
Link copied to clipboard
fun publisherBody(body: Flow.Publisher<ByteBuffer>, contentLength: Long? = null): HttpRequest.Builder

Sets the body of the HTTP request as a Publisher.

Link copied to clipboard
open override fun PUT(p0: HttpRequest.BodyPublisher): HttpRequest.Builder
Link copied to clipboard
fun query(name: String, vararg values: String): CustomHttpRequestBuilder

Adds a query parameter with multiple values.

Adds a query parameter with a single value.

Adds a query parameter with a list of values.

Link copied to clipboard
open override fun setHeader(p0: String, p1: String): HttpRequest.Builder
Link copied to clipboard

Adds multiple headers and overrides the old values

Link copied to clipboard

Set a query parameter with a list of values.

Link copied to clipboard

Set a query parameter with a list of values.

Link copied to clipboard
fun stringBody(value: String, charset: Charset = Charset.defaultCharset()): HttpRequest.Builder

Sets the body of the HTTP request as a String.

Link copied to clipboard
open override fun timeout(p0: Duration): HttpRequest.Builder
Link copied to clipboard
open override fun uri(uri: URI): HttpRequest.Builder

Sets the URI of the request.

Link copied to clipboard
open override fun version(p0: HttpClient.Version): HttpRequest.Builder