Why use Faraday over Net :: HTTP?

Why does someone use the Faraday stone against using Net :: HTTP directly? What is the advantage of using a wrapper like this?

+7
ruby wrapper faraday
source share
1 answer

Using the Net::HTTP adapter is fine, it’s just binding your code to a specific interface, which may differ from alternative tools. The main reason for using Faraday is that it wraps multiple adapters, one of which is Net::HTTP . If you use Faraday and start with Net:HTTP , you can use Excon , Typhoeus , Patron or EventMachine without changing more than a line or two configurations. If you used Net::HTTP directly, you would have to change a lot of implementation-specific code to switch to another adapter.

+10
source

All Articles