lib/grape/request.rb in grape-0.19.2 vs lib/grape/request.rb in grape-1.0.0

- old
+ new

@@ -2,29 +2,30 @@ class Request < Rack::Request HTTP_PREFIX = 'HTTP_'.freeze alias rack_params params + def initialize(env, options = {}) + extend options[:build_params_with] || Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder + super(env) + end + def params @params ||= build_params end def headers @headers ||= build_headers end private - def build_params - params = Hashie::Mash.new(rack_params) - if env[Grape::Env::GRAPE_ROUTING_ARGS] - args = env[Grape::Env::GRAPE_ROUTING_ARGS].dup - # preserve version from query string parameters - args.delete(:version) - args.delete(:route_info) - params.deep_merge!(args) - end - params + def grape_routing_args + args = env[Grape::Env::GRAPE_ROUTING_ARGS].dup + # preserve version from query string parameters + args.delete(:version) + args.delete(:route_info) + args end def build_headers headers = {} env.each_pair do |k, v|