lib/hanami/action/base_params.rb in hanami-controller-1.1.0 vs lib/hanami/action/base_params.rb in hanami-controller-1.1.1

- old
+ new

@@ -27,10 +27,22 @@ # # action unit test # action.call('rack.session' => { 'foo' => 'bar' }) # action.session[:foo] # => "bar" RACK_SESSION = 'rack.session'.freeze + # HTTP request method for Rack env + # + # @since 1.1.1 + # @api private + REQUEST_METHOD = 'REQUEST_METHOD'.freeze + + # Default HTTP request method for Rack env + # + # @since 1.1.1 + # @api private + DEFAULT_REQUEST_METHOD = 'GET'.freeze + # @attr_reader env [Hash] the Rack env # # @since 0.7.0 # @api private attr_reader :env @@ -148,9 +160,10 @@ if env.key?(RACK_INPUT) result.merge! ::Rack::Request.new(env).params result.merge! _router_params else result.merge! _router_params(env) + env[REQUEST_METHOD] ||= DEFAULT_REQUEST_METHOD end result end