Http module

Url_Problem

enumSource

Why parse_url refused a text, with .NONE for success.

Example
url, problem := parse_url("https://example.com:8443/a/b?x=1");
assert(problem == .NONE);
assert(url.secure && url.host == "example.com" && url.port == 8443);
assert(url.target == "/a/b?x=1");

_, problem = parse_url("ftp://example.com/");
assert(problem == .UNSUPPORTED_SCHEME);

_, problem = parse_url("/relative/path");
assert(problem == .NOT_A_URL);

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

Members

NONE
NOT_A_URL
no scheme://
UNSUPPORTED_SCHEME
anything but http and https
NO_HOST
BAD_PORT
BAD_HOST

See also