URI.to_string

You're seeing just the function to_string, go back to URI module for more information.

Specs

to_string(t()) :: binary()

Returns the string representation of the given URI struct.

Examples

iex> uri = URI.parse("http://google.com")
iex> URI.to_string(uri)
"http://google.com"

iex> uri = URI.parse("foo://bar.baz")
iex> URI.to_string(uri)
"foo://bar.baz"

Note that when creating this string representation, the :authority value will be used if the :host is nil. Otherwise, the :userinfo, :host, and :port will be used.

iex> URI.to_string(%URI{authority: "foo@example.com:80"})
"//foo@example.com:80"

iex> URI.to_string(%URI{userinfo: "bar", host: "example.org", port: 81})
"//bar@example.org:81"

iex> URI.to_string(%URI{
...>   authority: "foo@example.com:80",
...>   userinfo: "bar",
...>   host: "example.org",
...>   port: 81
...> })
"//bar@example.org:81"