klyn.net.HttpRequest.withMethod
method

    public withMethod(method as String) as HttpRequest throws Exception:

Description

Returns a copy with a different HTTP method.

Parameters

- method HTTP method. Empty means `GET`.

Returns

Updated request. ```klyn import klyn.net request = HttpRequest("https://example.com").withMethod("DELETE") print(request.method)` ``

Throws

- Exception if request validation, serialization, network transport, TLS handling, or response creation fails.