public HttpRequest(url as Object, method as String = "GET", headers as Map<String, String> = null, body as Object = null) throws Exception:
Creates an immutable HTTP request.
| Parameter | Description |
|---|---|
url | Absolute HTTP or HTTPS URL as String or URL. |
method | HTTP method. Empty means GET. |
headers | Optional request headers. |
body | Optional request body. |
import klyn.net
request = HttpRequest("https://example.com", "GET")
print(request.url.host)