create

fun create(json: Json, connectionTimeout: Duration = 2.seconds, requestTimeout: Duration = 10.seconds, socketTimeout: Duration = 10.seconds, maxConnections: Int = 128, enableLogging: Boolean = false, logLevel: LogLevel = LogLevel.INFO): HttpClient(source)

Creates a configured instance of an HttpClient with specified connection settings, timeouts, and JSON processing using kotlinx.serialization.

Return

a configured instance of HttpClient.

Parameters

json

the JSON instance for encoding and decoding JSON data. If not provided, a default instance is used.

connectionTimeout

the timeout duration for establishing connections, default is 2 seconds.

requestTimeout

the timeout duration for the entire request, default is 10 seconds.

socketTimeout

the timeout duration for reading data from sockets, default is 10 seconds.

maxConnections

the maximum number of connections allowed in the connection pool, default is 128.

enableLogging

whether to enable HTTP request/response logging, default is false.

logLevel

the logging level for HTTP requests, the default is LogLevel.INFO.