createRequest

Creates a new HttpRequest from a given builder lambda, using Kotlin DSL style.

This function allows for a more expressive, English-like syntax when creating an HttpRequest. It accepts a lambda with HttpRequest.Builder as its receiver, allowing the methods of HttpRequest.Builder to be called within the lambda without qualifying them.

This function is part of a DSL (Domain-Specific Language), which allows for clearer and more concise code.

Example usage:

val request = createRequest {
url("https://www.newurl.com/")
method(HttpMethod.Get)
}

This example creates a new HttpRequest with the specified properties.

Return

The constructed HttpRequest.

Important: This is a Public Preview API. It may be changed or removed at any time.

Parameters

init

A builder lambda used to configure the HttpRequest.