Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · url

Docs

std/url

On this page

Index

Types

EscapeErr

struct EscapeErr {
  msg: Str
}

A malformed escape or query; displays as Go’s text, for example invalid URL escape "%zz".

Source: std/url.xo:7

EscapeErr.display

fn (e: EscapeErr) display() -> Str

Source: std/url.xo:11

Values

struct Values {}

Query keys with their values in order (url.Values): keys in the order they first appeared, each with every value given for it. A value, not a handle.

Source: std/url.xo:27

Values.get

fn (v: Values) get(key: Str) -> Str?

The first value of key.

Source: std/url.xo:34

Values.all

fn (v: Values) all(key: Str) -> List[Str]

Every value of key, [] when missing.

Source: std/url.xo:36

Values.has

fn (v: Values) has(key: Str) -> Bool

Source: std/url.xo:37

Values.keys

fn (v: Values) keys() -> List[Str]

The keys in the order they first appeared.

Source: std/url.xo:39

Values.encode

fn (v: Values) encode() -> Str

a=1&b=2, sorted by key, each value escaped with query_escape (Values.Encode).

Source: std/url.xo:42

Values.add

fn (var v: Values) add(key: Str, value: Str)

Adds a value after the key’s others.

Source: std/url.xo:44

Values.set

fn (var v: Values) set(key: Str, value: Str)

Replaces every value of key with value.

Source: std/url.xo:46

Values.remove

fn (var v: Values) remove(key: Str)

Removes key and its values.

Source: std/url.xo:48

Functions

query_escape

fn query_escape(s: Str) -> Str

s escaped for a query key or value: space as +, every byte but letters, digits, -, ., _, and ~ as %XX (url.QueryEscape).

Source: std/url.xo:15

query_unescape

fn query_unescape(s: Str) -> Str ! EscapeErr

The inverse of query_escape: + is a space, %XX a byte.

Source: std/url.xo:17

path_escape

fn path_escape(s: Str) -> Str

s escaped for one path segment: space as %20, / escaped (url.PathEscape).

Source: std/url.xo:20

path_unescape

fn path_unescape(s: Str) -> Str ! EscapeErr

The inverse of path_escape: %XX a byte, + stays +.

Source: std/url.xo:22

values

fn values() -> Values

Source: std/url.xo:29

parse_query

fn parse_query(s: Str) -> Values ! EscapeErr

a=1&b=2&a=3 into Values; a ; separator, a bad escape, or more than 10000 parameters is an error, as url.ParseQuery.

Source: std/url.xo:32

↑ index