NAME
std/net/url - URL parsing, escaping, and templates.
SYNOPSIS
from std/net/url import *;
let parsed := parse(
"https://api.example.com/v1?q=tea%20time"
);
let encoded := escape("tea time");
let text := unescape(encoded);
let url := fill_template(
"https://api.example.com/{version}/items/{id}{?q}",
{ version: "v1", id: 7, q: "tea time" }
);
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module provides small URL helpers.
EXPORTS
Functions
escape(value)Parameters:
valueis any value. Returns:String. Percent-encodesvaluefor use in URLs.unescape(value)Parameters:
valueis URL-escaped text. Returns:String. Decodes percent-escaped text.parse(url)Parameters:
urlis a URL string. Returns:Dict. Parsesurland returns a dictionary with:url,scheme,authority,userinfo,host,port,path,query,fragment, andquery_params.fill_template(template, values)Parameters:
templateis an RFC6570-style template andvaluesis a dictionary or pair list. Returns:String. Fills the template usingvalues.
COPYRIGHT AND LICENCE
std/net/url is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.