acumen/url

A URL type that preserves the original server-provided string.

ACME servers provide URLs in JSON responses and HTTP headers. RFC 8555 Section 6.4 requires the exact server-provided string in signed JWS headers. This type stores the raw string alongside the parsed URI so that serialization never alters the URL.

Types

A validated HTTP(S) URL that preserves the original string.

Use to_string when the exact server-provided string is needed (JWS signing, JSON serialization). Use to_uri when URI components (host, path, scheme) are needed (HTTP request building).

pub opaque type Url

Values

pub fn decoder() -> decode.Decoder(Url)

JSON decoder for ACME URL fields.

pub fn from_string(string: String) -> Result(Url, Nil)

Parses a string into a Url.

Succeeds only for absolute HTTPS URLs with a host.

pub fn to_string(url: Url) -> String

Returns the original string, byte-for-byte as received.

pub fn to_uri(url: Url) -> uri.Uri

Returns the parsed URI for component access.

Search Document