class Rack::Typhoeus::Middleware::ParamsDecoder
@since 0.5.4
@author Dwayne Macgowan
decode!(params)
include Rack::Typhoeus::Middleware::ParamsDecoder::Helper
require ‘rack/typhoeus/middleware/params_decoder/helper’
@example Use the helper directly. Not recommended as b/c the interface might change.
use Rack::Typhoeus::Middleware::ParamsDecoder
@example Include the middleware for Rack based applications.
require ‘typhoeus/railtie’
@example Require the railtie when using Rails.
the nested params encoded by Typhoeus.
This Rack middleware takes care of the proper deserialization of
def call(env)
def call(env) req = Rack::Request.new(env) decode(req.params).each_pair { |k, v| update_params req, k, v } @app.call(env) end
def initialize(app)
def initialize(app) @app = app end
def update_params(req, k, v)
Persist params change in environment. Extracted from:
def update_params(req, k, v) found = false if req.GET.has_key?(k) found = true req.GET[k] = v end if req.POST.has_key?(k) found = true req.POST[k] = v end unless found req.GET[k] = v end end