Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

gmr/urilib

A RFC-3986 URI Library for parsing and building URIs

gmr/urilib.json
{
"createdAt": "2016-01-09T00:54:57Z",
"defaultBranch": "master",
"description": "A RFC-3986 URI Library for parsing and building URIs",
"fullName": "gmr/urilib",
"homepage": "https://hex.pm/packages/urilib",
"language": "Erlang",
"name": "urilib",
"pushedAt": "2018-09-27T14:15:21Z",
"stargazersCount": 13,
"topics": [],
"updatedAt": "2021-07-24T09:20:59Z",
"url": "https://github.com/gmr/urilib"
}

RFC-3986 URI Library for Erlang.

Parse and build URIs with automatic percent encoding and plus encoding of query arguments.

Version Downloads Build Status codecov.io

FunctionDescription
build/1Build a URI from a uri() or url.
parse/1Parse a URI from a string, returning a uri().
parse/2Parse a URI, returning the result as either a uri() or url().
percent_decode/1Decode a percent encoded string value.
percent_encode/1Percent encode a string value.
percent_encode/2Percent encode a string value, explicitly stating the desired case for hexidecimal values. Pass uppercase to the second value to have hex values returned as %2F instead of %2f.
plus_decode/1Decode a percent encoded string value that uses pluses for spaces.
plus_encode/1Percent encode a string value similar to percent_encode/1, but encodes spaces with a plus (+) instead of %20.
plus_encode/2Percent encode a string value similar to percent_encode/1, but encodes spaces with a plus (+) instead of %20, explicitly stating the desired case for hexidecimal values. Pass uppercase to the second value to have hex values returned as %2F instead of %2f.
TypeDefinition
scheme()`http
username()`string()
password()`string()
userinfo()`{username(), password()}
host()string()
authority(){userinfo(), host(), inet:port_number()}
path()string()
query()`[tuple()
fragment()`string()
uri(){scheme(), authority(), path(), query(), fragment()}
url(){scheme(), username(), password(), host(), inet:port_number(), path(), query(), fragment()}
Eshell V7.2.1 (abort with ^G)
1> urilib:build({http, {{"guest", "guest"}, "localhost", 15672}, "/api/queues", [{"name", "test"}], undefined}).
"http://guest:guest@localhost:15672/api/queues?name=test"
2> urilib:build({http, "guest", "guest", "localhost", 15672, "/api/queues", [{"name", "test"}], undefined}).
"http://guest:guest@localhost:15672/api/queues?name=test"
3> urilib:parse("http://guest:guest@localhost:15672/api/queues?name=test").
{http,{{"guest","guest"},"localhost",15672},
"/api/queues",
[{"name","test"}],
undefined}