URL-related functions. For more information on URL objects refer to the URL manual.
Convenience function to return a parsed object given URL string.
If the URL is already a parsed object then it will pass through.
Get URL filename.
Extract filename via url-filename.
Example:
(restlib-url-filename "https://heythey.com/mary?a=b&c=d%2Ce")
Result:
"/mary?a=b&c=d%2Ce"
Get URL path.
Extract only path from URL, omitting query parameters and fragment.
Example:
(restlib-url-path "https://heythey.com/mary?a=b&c=d%2Ce")
Result:
"/mary"
Get URL query.
Extract query as string from URL.
Example:
(restlib-url-query "https://heythey.com/mary?a=b&c=d%2Ce")
Result:
"a=b&c=d%2Ce"
Extract query items from URL.
Extract query items using url-parse-query-string.
Example:
(restlib-url-query-items "https://heythey.com/mary?a=b&c=d%2Ce")
Result:
(("c" "d,e") ("a" "b"))
url-build-query-string
Add query ITEMS to URL.
If URL has an existing query fragment, then ITEMS will be naively appended to it, with no regard for duplicate keys.
Example:
(restlib-url-add-query-items
"https://heythey.com/mary?a=b&c=d%2Ce"
'(("f" "j")))
Result:
"https://heythey.com/mary?c=d,e&a=b&f=j"
Remove query from URL.
Example:
(restlib-url-remove-query "https://heythey.com/mary?a=b&c=d%2Ce")
Result:
"https://heythey.com/mary"