Module: CGI::QueryExtension

Defined in:
lib/action_controller/cgi_ext/query_extension.rb

Instance Method Summary collapse

Instance Method Details

#initialize_queryObject

Neuter CGI parameter parsing.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/action_controller/cgi_ext/query_extension.rb', line 9

def initialize_query
  # Fix some strange request environments.
  env_table['REQUEST_METHOD'] ||= 'GET'

  # POST assumes missing Content-Type is application/x-www-form-urlencoded.
  if env_table['CONTENT_TYPE'].blank? && env_table['REQUEST_METHOD'] == 'POST'
    env_table['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
  end

  @cookies = CGI::Cookie::parse(env_table['HTTP_COOKIE'] || env_table['COOKIE'])
  @params = {}
end