Class: Rack::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/codebutler/sinatra.rb

Overview

:nodoc:

Constant Summary collapse

POST_TUNNEL_METHODS_ALLOWED =

Set of request method names allowed via the _method parameter hack. By default, all request methods defined in RFC2616 are included, with the exception of TRACE and CONNECT.

%w( PUT DELETE OPTIONS HEAD )

Instance Method Summary collapse

Instance Method Details

#request_methodObject

Return the HTTP request method with support for method tunneling using the POST _method parameter hack. If the real request method is POST and a _method param is given and the value is one defined in POST_TUNNEL_METHODS_ALLOWED, return the value of the _method param instead.



44
45
46
47
48
49
50
# File 'lib/codebutler/sinatra.rb', line 44

def request_method
  if post_tunnel_method_hack?
    params['_method'].upcase
  else
    @env['REQUEST_METHOD']
  end
end

#user_agentObject



52
53
54
# File 'lib/codebutler/sinatra.rb', line 52

def user_agent
  env['HTTP_USER_AGENT']
end