Skip to content

chrisb/rack-faraday_inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rack::FaradayInspector

Code Climate

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 and requires 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

Or in something like config/initializers/faraday_inspector.rb:

Rack::FaradayInspector.enabled = Rails.env.development?

Contributing

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

About

View Faraday requests made in your controllers on rendered pages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published