Skip to content

Latest commit

 

History

History
106 lines (84 loc) · 9.77 KB

README.md

File metadata and controls

106 lines (84 loc) · 9.77 KB

Awesome Faraday

A curated list of awesome middleware and adapters for Faraday. If you want your adapter or middleware to feature in this list, please open a discussion or a PR.

Adapters

Faraday allows you to change the adapter, the element in the stack responsible for performing the HTTP request, with ease, by the combination of a standardised API to provide configuration and request details, and a powerful set of middleware. However, each adapter can also offer unique features, or lack the support for others. The following table show the available adapters and which features they support.

Adapter Bundled with Faraday Reason Phrase parsing Compression (Gzip, Deflate) Response Streaming Parallel Requests GET, HEAD, DELETE, TRACE Request Body HEAD Response Body TRACE Method Local Socket Binding
Async::HTTP::Faraday ✖️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
EM::HTTP v1 only ✔️ ✖️ ✖️ ✔️ ✔️ ✖️ ✔️ ✔️
EM::Synchrony v1 only ✔️ ✖️ ✖️ ✔️ ✔️ ✖️ ✔️ ✔️
Excon v1 only ✔️ ✖️ ✖️ ✖️ ✔️ ✔️ ✔️ ✖️
HttpClient v1 only ✔️ ✔️ ✖️ ✖️ ✔️ ✔️ ✔️ ✔️
Net::HTTP ✔️ ✔️ ✔️ ✔️ ✖️ ✔️ ✔️ ✔️ ✖️
Net::HTTP::Persistent v1 only ✔️ ✔️ ✖️ ✖️ ✔️ ✔️ ✔️ ✖️
Patron v1 only ✔️ ✖️ ✖️ ✖️ ✖️ ✔️ ✖️ ✖️
Typhoeus v1 only ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✖️
HTTP.rb ✖️ ✔️ ✖️ ✔️ ✖️ ✔️ ✖️ ✔️ ✔️
httpx ✖️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️

Middleware

Under the hood, Faraday uses a Rack-inspired middleware stack for making requests. Much of Faraday’s power is unlocked with custom middleware. Some middleware is included with Faraday, and others are in external gems. Learn more about Middleware.

In addition to this curated list of middleware, we would like to specifically call your attention to middleware that is helpful for general HTTP use:

Awesome Community Middleware

Included with faraday itself

Bundled into their own gems

  • multipart - encode request body as a multipart form
  • retry - retry intermittent HTTP failures
  • rashify - parse responses into a Hashie::Mash::Rash
  • follow_redirects - follow HTTP 30X redirects
  • encode_xml - encode XML requests (responses decoding is included in faraday_middleware gem)
  • decode_xml - decode XML responses
  • XML Middleware - encodes requests as XML, parses response body into a hash of key/value pairs, and provides access to parser/encoder primitives for any custom handling.

faraday_middleware gem

ATTENTION: faraday_middleware have been deprecated and won't be updated to work on Faraday 2.0. All the middleware below will need to be moved into their own gems.

Has been moved into community gems (see list above):

  • mashify

Tooling