Premailex v0.3.5 Premailex.HTTPoisonAdapter View Source

Adapter module for HTTPoison.

Link to this section Summary

Functions

Fetches an URL and returns the body if the response has a 200 HTTP status code

Link to this section Functions

Link to this function get(url) View Source
get(String.t()) :: {:ok, String.t()} | {:error, term()}

Fetches an URL and returns the body if the response has a 200 HTTP status code.

Examples

iex> Premailex.HTTPoisonAdapter.get("http://localhost:4000/styles.css")
{:ok, "body {color: #000;}"}

iex> Premailex.HTTPoisonAdapter.get("http://localhost:4000/nonexistant.css")
{:error, %HTTPoison.Response{status_code: 404}}