Fetch.URL (Fetch v0.1.0)
View SourceTurns a URL string into the pieces an HTTP/1.1 request needs.
URI syntax is tokenized by URI.new/1 from the standard library. This
module adds the HTTP-specific part:
- only
httpandhttpsschemes - a host is required
- default ports: 80 for http, 443 for https
- the request target (
/path?query) — the fragment is never sent, it only exists on the client side - the authority for the
hostheader — the port is omitted when it is the default one, IPv6 literals are put back into brackets user:pass@hostis rejected: silently dropping credentials or sending them is a decision we do not make implicitly
Summary
Functions
Validates a request path such as /users?page=2 for a connection that
already knows its origin. The fragment is dropped.
Types
@type t() :: %{ scheme: :http | :https, host: String.t(), port: :inet.port_number(), authority: String.t(), target: String.t() }