klyn.net.HttpRequest.withBody
method

    public withBody(body as Object) as HttpRequest throws Exception:

Description

Returns a copy with a different request body.

Parameters

- body Optional request body.

Returns

Updated request. ```klyn import klyn.net request = HttpRequest("https://example.com/api", "POST").withBody({"hello": "world"}) print(request.method)` ``

Throws

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