Rack::FaradayInspector

Rack::FaradayInspector renders a bit of HTML at the bottom of your pages that allows you to inspect all of the HTTP requests Faraday made during the current Rails action.

It's like your browser's developer tools network view, but for your backend API requests.

rack-faraday_inspector

Currently only supports Rails. Requires SASS and jQuery.

Installation

Add this line to your application's Gemfile:

gem 'rack-faraday_inspector', github: 'chrisb/rack-faraday_inspector'

I'm still actively working on this Gem, so pull from GitHub.

Usage

In order to instrument and show Faraday requests, you'll need to add the middleware to your connection:

Faraday.new url: 'http://www.sushi.com' do |faraday|
  faraday.use :inspector
  # ...
end

By default the inspector web UI is disabled. To enable the inspector, add the following to an initializer, or better yet, to the specific Rails environment configurations that you want to enable the inspector for:

i.e. in config/environments/development.rb:

Rails.application.configure do
  # ...
  Rack::FaradayInspector.enabled = true
end

Note: only in the development environment will requests be instrumented and the inspector rendered.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/chrisb/rack-faraday_inspector.