Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (27 sloc) 0.735 kb
require 'rack/utils'
module Goliath
module Rack
# A middle ware to parse params. This will parse both the
# query string parameters and the body and place them into
# the _params_ hash of the Goliath::Env for the request.
#
# @example
# use Goliath::Rack::Params
#
class Params
def initialize(app)
@app = app
end
def call(env)
env['params'] = retrieve_params(env)
@app.call(env)
end
def retrieve_params(env)
params = {}
params.merge!(::Rack::Utils.parse_query(env['QUERY_STRING']))
params.merge!(::Rack::Utils.parse_query(env['rack.input'].read)) unless env['rack.input'].nil?
params
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.