Sha256: 26d1eb9a9e5496d6f308d91ab94c92ebf3a68e3776d4be28405b849aad9528ac
Contents?: true
Size: 712 Bytes
Versions: 20
Compression:
Stored size: 712 Bytes
Contents
# encoding: utf-8 module Hyperdrive module Middleware class SanitizeParams def initialize(app) @app = app end def call(env) unless %w(OPTIONS TRACE).include? env['REQUEST_METHOD'] request = Rack::Request.new(env) params = Hyperdrive::Utils.symbolize_keys(request.params) if %w(GET HEAD).include? env['REQUEST_METHOD'] params_to_keep = env['hyperdrive.resource'].filters.keys else params_to_keep = env['hyperdrive.resource'].params.keys end env['hyperdrive.params'] = Hyperdrive::Utils.sanitize_keys(params_to_keep, params) end @app.call(env) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems