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



71
72
73
74
75
76
77
78
# File 'lib/tipsy/server.rb', line 71

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