mutate

Creates a new instance of HttpRequest based on this object, using a Kotlin domain-specific language (DSL) builder.

This function provides a way to modify an existing HttpRequest using expressive, English-like syntax.

The current HttpRequest is converted to a builder, and then the init lambda with HttpRequest.Builder as its receiver is applied. This allows the lambda to invoke the methods of HttpRequest.Builder without having to qualify them.

Example usage:

val newRequest = oldRequest.mutate {
url("https://www.newurl.com/")
}

This example modifies the url of the oldRequest.

Return

The mutated HttpRequest.

Parameters

init

Lambda function where HttpRequest.Builder functions can be called.