HttpResponse¶
Import: import system.net;
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
HttpResponse¶
Response metadata and a streamed body. Explicit closure releases unfinished bodies.
status¶
Numeric HTTP status; non-2xx responses are successful transport results.
url¶
Final URL after any redirects visible to the host.
headers¶
Response headers visible to the host; browser CORS rules can hide some headers.
body¶
Byte stream owned by this response; a retained body can be read independently.
read_text¶
Reads remaining body text up to max_bytes using strict incremental UTF-8 decoding. Limit or decoding failures consume input already read; close the response after any failure.
public async fun read_text(
max_bytes: int = 1048576,
token: Option<CancellationToken> = Option.None
): Result<string, HttpError>
close¶
Closes the body idempotently; subsequent reads return ECLOSED.