Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.

jeremyevans/rack-indifferent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rack-indifferent

rack-indifferent modifies rack to make the hash it stores query params in support indifferent access (access via strings or symbols). This makes it so web frameworks/applications that use rack-indifferent don’t have to make a deep copy of the params to allow indifferent access to the params.

Note that while this allows you to save a character when accessing the params (params[:param_name] instead of params["param_name"]), it is a bad idea in general as it makes it more difficult to separate untrusted external data access (via strings) from internal trusted data (via symbols). Mixing the two types of data access (i.e. treating untrusted data as trusted) is a common security vulnerability, and this library makes it easier to be vulnerable.

Installation

gem install rack-indifferent

Source Code

Source code is available on GitHub at github.com/jeremyevans/rack-indifferent

Basic Usage

You just need to require the library:

require 'rack/indifferent'

On rack 1, this will monkey patch a rack class to change the query params hashes that rack uses to use indifferent access.

On rack 2, this will set a new default query parser that uses hashes with indifferent access. Note that web frameworks and applications that use custom query parsers in their request class will not be affected by rack-indifferent.

License

MIT

Maintainer

Jeremy Evans <[email protected]>

About

Fast indifferent access to request params

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages