HttpUrlBuilder

A builder for constructing HTTP URLs. This class allows for the configuration of scheme, host, port, path and query parameters to build a URI.

This class provides a fluent interface for method chaining.

Example of usage: url("https://api.tomtom.com/search/2/search/amsterdam.json?key=123&lat=52.3&lon=5.1") { path("/search/2/search") queryParams { remove("key") "token" to "xyz" } } // -> https://api.tomtom.com/search/2/search/amsterdam.json?lat=52.3&lon=5.1&token=xyz

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

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Functions

Link copied to clipboard

Adds multiple query parameters to the URL.

Link copied to clipboard

Adds a query parameter to the URL or replaces it if it already exists.

Link copied to clipboard

Adds a query parameter to the URL.

Link copied to clipboard
fun build(): URI

Constructs the URI from the configured URL parts.

Link copied to clipboard

Sets the host of the URL.

Link copied to clipboard

Sets the path of the URL. Optional parameter. Default value is /.

Link copied to clipboard
fun port(port: Int): HttpUrlBuilder

Sets the port of the URL. Optional parameter.

Link copied to clipboard

Sets the query string of the URL. Optional parameter.

Link copied to clipboard

Applies a configuration block to the query parameters of the URL.

Link copied to clipboard

Removes all query parameters from the URL.

Link copied to clipboard

Removes a query parameter from the URL.

Link copied to clipboard

Sets the scheme of the URL. Optional parameter. Default value is https.