talira

Functional, low-level HTTP/1 and HTTP/2 client for Elixir

open sourceApache-2.0free

Mint is a low-level HTTP client for Elixir with HTTP/1.1 and HTTP/2 support. Instead of running its own processes, it represents a connection as an immutable data structure wrapping a TCP or SSL socket, so the developer decides the architecture: one process handling several connections, or different kinds of processes for different connections. It picks HTTP/1 or HTTP/2 when connecting and streams responses back in parts (status, headers, data, done). It has no pooling or WebSocket support itself: Finch builds connection pooling on top of it, and mint_web_socket adds WebSockets. Its authors are Eric Meadows-Jönsson and Andrea Leopardi.

Problems it solves

  • make HTTP/2 requests from Elixir without a process per connection
  • build my own connection pool or HTTP client on a low-level Elixir library
  • stream a large HTTP response in Elixir piece by piece

Features

  • HTTP/1.1 and HTTP/2, chosen when connecting
  • Process-less: a connection is an immutable data structure
  • Streams responses in parts: status, headers, data and done
  • Uses the system's CA certificates on Erlang/OTP 25 and later

Limitations

  • No connection pooling or WebSocket support of its own: Finch and mint_web_socket add them on top.1

Alternatives

The same job

These do what Mint does.

  1. HTTPoison Yet another HTTP client for Elixir, powered by hackney
  2. Finch Performance-focused HTTP client for Elixir
  3. Req A batteries-included HTTP client for Elixir
  4. hackney An HTTP client for Erlang. Simple, reliable, fast.
  5. Tesla The flexible HTTP client library for Elixir, with middleware and multiple adapters
  6. Gun Erlang HTTP/1.1, HTTP/2 and Websocket client

Compare Mint with the top 3