Documentation ¶
Overview ¶
Commands for processing and working with URLs.
Index ¶
- Variables
- type Commands
- func (self *Commands) EncodeQuery(querymap interface{}) (string, error)
- func (self *Commands) Escape(stringOrStruct interface{}) (string, error)
- func (self *Commands) Parse(u interface{}) (*URL, error)
- func (self *Commands) ParseQuery(urlOrQueryString interface{}) (map[string]interface{}, error)
- func (self *Commands) Unescape(stringOrStruct interface{}) (string, error)
- type URL
Constants ¶
This section is empty.
Variables ¶
var DefaultUrlScheme = executil.Env(`FRIENDSCRIPT_URL_DEFAULT_SCHEME`, `https`)
if unspecified, default to HTTPS. This is probably in violation of some RFC, but in 2020 I'd rather default to encryption over none. If the scheme is important to the user, they should specify it. This is also exposed as a package-level variable that implementers may change directly or via environment variable
Functions ¶
This section is empty.
Types ¶
type Commands ¶
func (*Commands) EncodeQuery ¶
Take a map or previous URL response structure and encode the values into a string that can be used in another URL or form post data. This command does not automaticlly prepend a "?" character to the output.
func (*Commands) Escape ¶
Escapes the string so it can be safely placed inside a URL path segment, replacing special characters (including /) with %XX sequences as needed.
func (*Commands) Parse ¶
Parse the given URL string or structure, and return a structured representation of the various parts of a URL.
func (*Commands) ParseQuery ¶
Take a URL or map of query string key=value pairs and return a map of values.
type URL ¶
type URL struct { Scheme string `json:"scheme"` Host string `json:"host"` Domain string `json:"domain"` Port int `json:"port"` Path string `json:"path"` RawQuery string `json:"rawquery"` Fragment string `json:"fragment"` Query map[string]interface{} `json:"query"` Full string `json:"full"` // contains filtered or unexported fields }