Add logging and automatic JSON parsing to all HTTP requests in your Ruby app without changing your core request code.
Build a reusable Ruby API client library that lets users swap the underlying HTTP adapter without rewriting anything.
Insert retry logic for failed requests by stacking Faraday middleware in the order you choose.
Faraday is a Ruby library for making HTTP requests. HTTP requests are how programs talk to web APIs and external services, and Faraday provides a single consistent interface for doing that regardless of which underlying HTTP tool you actually use. Instead of locking you into one specific HTTP client, Faraday sits on top of many different adapters, such as Net::HTTP (built into Ruby's standard library), Typhoeus, Patron, Excon, HTTPClient, and others, letting you swap between them without rewriting your code. The library borrows an idea from Rack, a standard component used in Ruby web applications. In Rack, requests pass through a chain of middleware pieces, each of which can inspect or modify the request or response before passing it along. Faraday applies the same pattern to outgoing HTTP calls. You can insert middleware for things like logging, retrying failed requests, authentication, or automatic JSON parsing, stacking them in the order you choose. Features built into Faraday include persistent connections (also called keep-alive, which avoids the overhead of opening a new connection for every request), parallel requests, automatic parsing of JSON and XML responses, file uploads, and streaming responses for large payloads. The library is aimed at developers building API clients or wrappers around web services in Ruby. Instead of coupling your library to a single HTTP tool, you write against Faraday's interface and let users choose the adapter that fits their environment. The project supports Ruby 3.0 and above. The README is brief and points to the project website and API documentation for more detail.
← lostisland on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.