Go to file
Rob Watson b5ac5945f7 Update README 2017-07-18 12:57:56 +01:00
bin Initial commit 2017-07-10 08:37:08 +01:00
lib/rack Bump version > 0.3 2017-07-18 06:19:37 +01:00
spec Refactor class/module structure 2017-07-18 06:19:37 +01:00
.gitignore Initial commit 2017-07-10 08:37:08 +01:00
.rspec Initial commit 2017-07-10 08:37:08 +01:00
.travis.yml Initial commit 2017-07-10 08:37:08 +01:00
Gemfile Initial commit 2017-07-10 08:37:08 +01:00
LICENSE.txt Initial commit 2017-07-10 08:37:08 +01:00
README.md Update README 2017-07-18 12:57:56 +01:00
Rakefile Initial commit 2017-07-10 08:37:08 +01:00
rack-filter-param.gemspec Initial commit 2017-07-10 08:37:08 +01:00

README.md

rack-filter-param

Refactoring something behind an API? Plagued by extraneous HTTP params? rack-filter-param might be for you.

Build Status

What is it?

Rack middleware to remove specific params from HTTP requests.

What does it do?

Given a set of params and optional constraints, rack-filter-param will remove those params, then pass the request downstream.

Removes params from:

Installation


gem 'rack-filter-param', require: 'rack/filter_param'

Usage

In rackup file or application.rb, initialize rack-filter-param with a list of HTTP params you want filtered from requests.

Strip a parameter named client_id:

use Rack::FilterParam, :client_id

Strip a parameter named client_id from a specific path only:

use Rack::FilterParam, { param: :client_id, path: '/oauth/tokens' }

Strip a parameter named client_id from a fuzzy path:

use Rack::FilterParam, { param: :client_id, path: /\A\/oauth/ }

Strip a parameter named client_id based on arbitrary logic:

use Rack::FilterParam, { param: :client_id, if: -> (value) { ... } }

To filter multiple parameters, an array of parameters or options hashes can also be passed.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rfwatson/rack-filter-param

License

The gem is available as open source under the terms of the MIT License.