sema-url 0.1.0

API reference · 9 exports

Source declarations and literal docstrings from this release. Package code was not executed.

url/absolute?

(url/absolute? url)
Return #t when url is absolute, i.e. starts with a scheme followed by ://.

Source: package.sema:188

url/build

(url/build parts)
Build a URL string from a parts map ({:scheme :userinfo :host :port :path :query :fragment}). nil parts are omitted; :query and :fragment are emitted verbatim (already-encoded).

Source: package.sema:169

url/decode

(url/decode s)
Percent-decode a URL-encoded string. %XX sequences are decoded as UTF-8 bytes, + becomes a space, and a % not followed by two hex digits is kept literally.

Source: package.sema:72

url/encode

(url/encode s)
Percent-encode a string for use in a URL component. Everything outside RFC 3986 unreserved characters is encoded; non-ASCII characters are encoded as their UTF-8 bytes (e.g. "é" → "%C3%A9").

Source: package.sema:62

url/join

(url/join base ref)
Resolve ref against base, RFC 3986 style. An absolute ref replaces base; an absolute path replaces base's path; a relative path resolves against the directory of base's path (with ./.. normalization). Base's query and fragment are dropped; ref's are kept.

Source: package.sema:197

url/parse

(url/parse url)
Parse a URL into {:scheme :userinfo :host :port :path :query :fragment}. Absent parts are nil; path defaults to "/". :port is an integer — a non-numeric port raises an error. IPv6 host literals are not supported.

Source: package.sema:126

url/query-build

(url/query-build m)
Build a query string from a map, percent-encoding keys and values. Keys are emitted in sorted order; non-string values go through str.

Source: package.sema:114

url/query-parse

(url/query-parse qs)
Parse a query string like "a=1&b=2" into a map of decoded strings. nil or "" gives {}. A key without = gets value ""; when a key repeats, the last value wins.

Source: package.sema:98

url/with-query

(url/with-query url params)
Return url with its query string replaced by the encoded params map. An empty map removes the query; the fragment is preserved.

Source: package.sema:192