View Source HTTPSpec.Request.URL (http_spec v3.0.0)

Helpers for handling URL.

Summary

Functions

Parses an URL.

Bang version of parse/1.

Types

@type t() :: %HTTPSpec.Request.URL{
  fragment: nil | binary(),
  host: nil | binary(),
  path: nil | binary(),
  port: nil | :inet.port_number(),
  query: nil | binary(),
  scheme: :http | :https
}

Functions

@spec parse(String.t()) :: {:ok, t()} | {:error, HTTPSpec.Request.URL.ParseError.t()}

Parses an URL.

Examples

iex> HTTPSpec.Request.URL.parse("http://www.example.com/?say=hi#mom")
{:ok,
 %HTTPSpec.Request.URL{
   scheme: :http,
   host: "www.example.com",
   port: 80,
   path: "/",
   query: "say=hi",
   fragment: "mom"
 }}
@spec parse!(String.t()) :: t()

Bang version of parse/1.