request

open override fun request(): KtorHttpRequest

Creates a new KtorHttpRequest instance.

This factory method creates a new request object that can be configured with URL, headers, parameters, and body before being sent.

Return

A new KtorHttpRequest instance.


open suspend override fun request(request: HttpRequest): KtorHttpResponse

Sends an HTTP request and returns the response.

This method takes a fully configured KtorHttpRequest, converts it to a Ktor request, executes it using the underlying Ktor client, and wraps the response in a KtorHttpResponse.

Return

The HTTP response wrapped in a KtorHttpResponse.

Parameters

request

The HTTP request to send. Must be a KtorHttpRequest instance.

Throws

if the request fails, times out, or encounters a network error.


open suspend override fun request(requestBuilder: HttpRequest.() -> Unit): KtorHttpResponse

Sends an HTTP request built with a builder lambda and returns the response.

This is the most convenient way to make HTTP requests. It creates a new request, applies the builder lambda to configure it, and then sends it.

Return

The HTTP response wrapped in a KtorHttpResponse.

Parameters

requestBuilder

A lambda that configures the request using DSL syntax.

Throws

if the request fails, times out, or encounters a network error.