Skip to content

std/url

std/url — URL percent-encoding, URL parsing, and query string parsing. url_encode(s) / url_decode(s) — RFC 3986 %-encoding. url_parse(s) — decompose into a Url struct. query_parse(s) — URL-encoded query → Map. + is left alone in both encode and decode (callers handling application/x-www-form-urlencoded pre-process). url_parse is best-effort: returns None only on empty input; otherwise fills missing sections with empty strings / port=0. Query duplicates collect into a string[] per key. Migrated from the auto-injected prelude per docs/PRELUDE-TO-MODULES.md.

pub function url_encode(s: string): string
pub function url_decode(s: string): string
pub function url_parse(s: string): Option[Url]
pub function query_parse(s: string): Map[string, string[]]