klyn.net.URL.toHttpRequest
method

    public toHttpRequest(method as String = "GET",
    headers as Map<String, String> = null,
    body as Object = null) as HttpRequest throws Exception:

Description

Builds an HTTP request targeting this URL.

Parameters

Parameter | Description
--- | ---
`method` | HTTP method. Empty means `GET`.
`headers` | Optional request headers.
`body` | Optional request body.

Returns

Immutable HTTP request.

Throws

- ProtocolException when the scheme is unsupported.

Example

    import klyn.net

    url = URL("https://example.com")
    request = url.toHttpRequest()
    print(request.method)