klyn.net.HttpClient.sendBinary
method
public sendBinary(request as HttpRequest, maxBytes as Long = 16777216l) as HttpBinaryResponse
Description

Sends a request without decoding the entity bytes as text. TLS, redirects, timeout and cancellation use the same transport as send. Bodies exceeding maxBytes are rejected with IOException. This API retains the bounded response in memory; use a streaming downloader for large files.

Parameters
ParameterDescription
requestImmutable request (its optional body retains normal send semantics).
maxBytesMaximum response bytes, between 0 and 64 MiB.
Returns

Status, headers and exact binary content.

Throws
  • ValueException for an invalid limit; IOException for transport/size failures.
Example

response = HttpClient().sendBinary(HttpRequest(url), maxBytes=1048576l)