Class: Tipsy::Server::Request

Inherits:
Rack::Request
  • Object
show all
Defined in:
lib/tipsy/server.rb

Overview

Subclass Rack::Request to create a rails-like params hash.

Instance Method Summary collapse

Instance Method Details

#paramsObject



57
58
59
60
61
62
63
64
# File 'lib/tipsy/server.rb', line 57

def params
  @params ||= begin
    hash = HashWithIndifferentAccess.new.update(Rack::Utils.parse_nested_query(query_string))
    post_params = form_data? ? Rack::Utils.parse_nested_query(body.read) : {}
    hash.update(post_params) unless post_params.empty?
    hash
  end
end