Library for parsing and constructing URLs
A Dict that holds keys and values for the query string
Parse a url string, returns an Erl.Url record
Erl.parse "http://api.example.com/users/1#x/1?a=1" == Erl.Url{...}Extract the hash (hash) from the url
Extract the host from the url
Extract the path from the url
Extract the protocol from the url
Extract the port from the url
Extract the query string from the url
Generate an empty Erl.Url record
Erl.new ==
{
protocol = "",
username = "",
password = "",
host = [],
path = [],
port' = 0,
hash = [],
query = Dict.empty
}Generate url string from an Erl.Url record
url = {
protocol = "http",
username = "",
password = "",
host = ["www", "foo", "com"],
path = ["users", "1"],
port' = 2000,
hash = ["a", "b"],
query = Dict.empty |> Dict.insert "q" "1" |> Dict.insert "k" "2"
}
Erl.toString url == "http://www.foo.com:2000/users/1#a/b?k=2&q=1"Set key/value in query string
Erl.addQuery key value urlSet key/value in query string, removes any existing ones
Erl.setQuery key value urlRemoves key from query string
Erl.removeQuery key urlClears the current query string
Erl.clearQuery url
Record that holds url attributes