HTTP/1 and HTTP/2 client for Elixir. Based on Gun and Poolboy.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config Initial commit Jan 13, 2018
lib Fix warning Aug 28, 2018
test Initial commit Jan 13, 2018
.gitignore Ignore mix.lock Jan 24, 2018
LICENSE Initial commit Jan 13, 2018
README.md Update README Sep 11, 2018
mix.exs 0.1.2. Use gun 1.1. Aug 28, 2018

README.md

Hex.pm version Hex.pm downloads

MachineGun

HTTP client for Elixir. Based on Gun and Poolboy.

  • Supports HTTP/1 and HTTP/2 with automatic detection;
  • Maintains separate connection pool for each pool_group:host:port combination;
  • Allows per-pool configuration;
  • Drop-in replacement for HTTPoison.

Example

%MachineGun.Response{body: body, status_code: 200} =
  MachineGun.get!(
    "http://icanhazip.com",
    [{"accept", "text/plain"}],
    %{request_timeout: 5000, pool_group: :default})

(Options are included to show defaults and can be omitted.)

Configuration

config :machine_gun,
  # Default pool group
  default: %{
    pool_size: 4,         # Poolboy size [1]
    pool_max_overflow: 4, # Poolboy max_overflow [1]
    pool_timeout: 1000,
    conn_opts: %{}        # Gun connection options [2]
  }

(Configuration example shows defaults and can be omitted.)

  1. https://github.com/devinus/poolboy#options
  2. https://ninenines.eu/docs/en/gun/1.0/manual/gun/