HttpClient
class in package klyn.net

    public class HttpClient extends Object:

Object
└ HttpClient

Modern HTTP client.

`HttpClient` sends immutable `HttpRequest` values and returns `HttpResponse` objects. HTTPS-specific settings are carried by `TlsOptions`.

    import klyn.net

    client = HttpClient()
    response = client.get("https://example.com")
    print(response.statusCode)

Properties

Modifier and Type | Member | Description
--- | --- | ---
public property | followRedirects `followRedirects as Boolean:` | Redirect-following flag.
public property | timeout `timeout as ULong:` | Default request timeout in milliseconds.
public property | tlsOptions `tlsOptions as TlsOptions:` | Default TLS options used for HTTPS requests.

Properties inherited from Object: type
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | HttpClient `HttpClient(timeout as ULong = 0u, followRedirects as Boolean = true, tlsOptions as TlsOptions = null):` | Creates an HTTP client.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | cancel `cancel() as Void:` | Requests cancellation of the HTTP call currently running for this client.
public | deleteRequest `deleteRequest(url as Object, headers as Map<String, String> = null) as HttpResponse throws Exception:` | Sends a `DELETE` request.
public | get `get(url as Object, headers as Map<String, String> = null) as HttpResponse throws Exception:` | Sends a `GET` request.
public | patch `patch(url as Object, body as Object = null, headers as Map<String, String> = null) as HttpResponse throws Exception:` | Sends a `PATCH` request.
public | post `post(url as Object, body as Object = null, headers as Map<String, String> = null) as HttpResponse throws Exception:` | Sends a `POST` request.
public | put `put(url as Object, body as Object = null, headers as Map<String, String> = null) as HttpResponse throws Exception:` | Sends a `PUT` request.
public | request `request(method as String, url as Object, headers as Map<String, String> = null, body as Object = null) as HttpResponse throws Exception:` | Sends one request built from ad-hoc values.
public | send `send(request as HttpRequest) as HttpResponse throws Exception:` | Sends one HTTP request.

Methods inherited from Object: fromJson, toDict, toJson, toString, toXml