lib/hanami/router.rb in hanami-router-2.0.0.alpha5 vs lib/hanami/router.rb in hanami-router-2.0.0.alpha6
- old
+ new
@@ -1,7 +1,8 @@
# frozen_string_literal: true
+require "rack"
require "rack/utils"
module Hanami
# Rack compatible, lightweight and fast HTTP Router.
#
@@ -866,10 +867,16 @@
# @since 2.0.0
# @api private
def _params(env, params)
params ||= {}
env[PARAMS] ||= {}
- env[PARAMS].merge!(Rack::Utils.parse_nested_query(env["QUERY_STRING"]))
+
+ if (input = env[Rack::RACK_INPUT]) and input.rewind
+ env[PARAMS].merge!(Rack::Utils.parse_nested_query(input.read))
+ input.rewind
+ end
+
+ env[PARAMS].merge!(Rack::Utils.parse_nested_query(env[Rack::QUERY_STRING]))
env[PARAMS].merge!(params)
env[PARAMS] = Params.deep_symbolize(env[PARAMS])
env
end