HTTPoison is an Elixir HTTP client built on Hackney. It supports sync and async requests, pools, cookies, and multipart bodies.
Overview
HTTPoison is an HTTP client for Elixir programs, implemented on top of the Hackney library. It exposes familiar get, post, and other verbs with structured response and error types you can pattern match in application code.
Requests accept numerous options documented alongside Hackney, including SSL settings, receive timeouts, and hooks for client certificates. A major-version change made SSL options merge with defaults instead of replacing them, with an explicit override flag for prior behavior.
The HTTPoison.Base module lets you wrap the client to build dedicated API clients with shared defaults. Async modes stream response chunks to the caller, with a once mode to avoid flooding processes on very large bodies.
Cookie headers can be sent and set-cookie values read from responses. Multipart uploads cover files on disk and in-memory blobs. Connection pooling reuses keepalive links per host through Hackney pools, with ways to name pools, create them at startup, or disable pooling per request.
Key features
- REST-style HTTP verbs
- Hackney-backed connection pools
- Async streaming responses
- SSL and timeout options
- Cookie send and receive
- Multipart upload and parse
- HTTPoison.Base client wrappers
- Low-level Hackney request logging
Use cases
- Call external REST APIs from Elixir
- Build typed third-party API clients
- Stream large HTTP downloads
- Upload files via multipart forms