Http module

Client_Error_Kind

enumSource

What went wrong when the client did not get, or could not read, an answer (Client_Error.kind), with .NONE for success. A response with any HTTP status, a 404 included, is not an error; error_for_status turns a non-2xx status into .STATUS.

Example
// A URL the client cannot request is refused before anything is sent.
api: Client;
response, error := get(*api, "ftp://example.com/file");

assert(error.kind == .INVALID_URL);
assert(response.status == 0);

Doesn't run in the browser (skipped on wasm).

Members

NONE
no error: .{}
TRANSPORT
connecting, sending or receiving failed (transport says how)
TIMED_OUT
the request took longer than its timeout
INVALID_URL
the URL cannot be requested
TLS
the TLS handshake or the check of the server's certificate failed (detail says why)
REDIRECTS
too many redirects
DECODE
the body was not what read_json asked for (json says why)
BODY
the body cannot be read: it was read already, or the response was closed
TOO_LARGE
the body is longer than the request's max_response_size
STATUS
error_for_status: the response was not 2xx
INVALID_METHOD
the request's method is .OTHER, which has no spelling to put on the wire

See also