request
Creates a new HTTP request instance.
This factory method creates a new request object that can be configured with URL, headers, parameters, cookies, and body before being sent.
This method is useful when you need to:
Build a request incrementally
Reuse request configuration
Pass requests between functions
For most use cases, prefer the request { } DSL method for its cleaner syntax.
Return
A new HTTP request instance.
Sends an HTTP request and returns the response.
This method takes a fully configured request object and executes it, returning the response. The request is sent asynchronously using Kotlin Coroutines, allowing the calling code to suspend until the response is received.
Return
The HTTP response.
Parameters
The HTTP request to send.
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 using a clean DSL syntax, and then sends it. This method is recommended for most use cases.
The lambda receiver is an HttpRequest, allowing you to configure all aspects of the request including URL, headers, parameters, cookies, and body.
Return
The HTTP response.
Parameters
A lambda that configures the request using DSL syntax.