args() = #{scheme => nonempty_string() | nonempty_binary(), host => nonempty_string() | nonempty_binary(), port => non_neg_integer(), path => path(), query => query()}
nonempty_binary() = <<_:8, _:_*8>>
option() = relative
path() = string() | binary() | [nonempty_string() | nonempty_binary()]
query() = [{Key::atom() | nonempty_string() | nonempty_binary(), Value::boolean() | integer() | string() | nonempty_binary()}]
abstract datatype: uri()
new/0 | Create a new, "empty" URI. |
new/1 | Create a URI from args() . |
to_binary/1 | Same as to_string/1 but returns a binary() . |
to_binary/2 | Same as to_string/2 but returns a binary() . |
to_string/1 | Turn a uri() into a string() . |
to_string/2 | Turn a uri() into a string() with some options. |
new() -> uri()
Create a new, "empty" URI.
This will default to an uri pointing to https://localhost
. In other words,
the scheme will be set to https
, the port to 443
, the host to localhost
and both the path and the query will be left empty.
euri:new(#{})
.
Create a URI from args()
.
args()
are optional. When not supplied,
defaults will be used: scheme
defaults to https
, host
defaults to
localhost
, port
to 443
and the path
and query
are left empty when
not supplied.
to_binary(U::uri()) -> nonempty_binary()
Same as to_string/1
but returns a binary()
.
to_binary(U::uri(), Opts::[option()]) -> nonempty_binary()
Same as to_string/2
but returns a binary()
.
to_string(U::uri()) -> nonempty_string()
Turn a uri()
into a string()
.
By default, this will be an absolute URL including the scheme, hostname and port (unless the port is the default port for the given scheme).
Uri = euri:new(), "https://localhost" = euri:to_string(Uri). Uri = euri:new(#{host => "neverssl.com", scheme => "http"}). "http://neverssl.com" = euri:to_string(Uri).This is equivalent to calling
euri:to_string(Uri, [])
.
Turn a uri()
into a string()
with some options.
option()
is relative
which will make this
function return an URL relative to the root of the hostname.
Generated by EDoc