Host.HTTP.BlockedError exception (Beamlet v0.1.1)

Copy Markdown View Source

The error for a request Host.HTTP will not send.

Host.HTTP reaches the public internet. A request whose host is loopback, on a private network, link-local or another reserved address, or whose host does not resolve, comes back as {:error, %Host.HTTP.BlockedError{}}, and the bang variant raises it. A redirect is checked the same way, so a public URL that redirects to a private one is refused at the redirect.

url is the URL refused, without any credentials it carried, and reason an atom saying why, such as :reserved_address or :unresolvable_host.

{:error, %Host.HTTP.BlockedError{reason: :reserved_address}} =
  Host.HTTP.get("http://localhost:4000/")

Summary

Types

t()

The URL refused, without credentials, and why.

Types

t()

@type t() :: %Host.HTTP.BlockedError{
  __exception__: term(),
  reason: atom(),
  url: URI.t()
}

The URL refused, without credentials, and why.