Class: Sinatra::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- Sinatra::Request
- Defined in:
- lib/sinatra/base.rb
Overview
The request object. See Rack::Request for more info: rack.rubyforge.org/doc/classes/Rack/Request.html
Instance Method Summary collapse
-
#accept ⇒ Object
Returns an array of acceptable media types for the response.
-
#params ⇒ Object
Override Rack 0.9.x’s #params implementation (see #72 in lighthouse).
- #secure? ⇒ Boolean
- #user_agent ⇒ Object
Instance Method Details
#accept ⇒ Object
Returns an array of acceptable media types for the response
26 27 28 |
# File 'lib/sinatra/base.rb', line 26 def accept @env['HTTP_ACCEPT'].to_s.split(',').map { |a| a.strip } end |
#params ⇒ Object
Override Rack 0.9.x’s #params implementation (see #72 in lighthouse)
31 32 33 34 35 |
# File 'lib/sinatra/base.rb', line 31 def params self.GET.update(self.POST) rescue EOFError, Errno::ESPIPE self.GET end |
#secure? ⇒ Boolean
37 38 39 |
# File 'lib/sinatra/base.rb', line 37 def secure? (@env['HTTP_X_FORWARDED_PROTO'] || @env['rack.url_scheme']) == 'https' end |
#user_agent ⇒ Object
21 22 23 |
# File 'lib/sinatra/base.rb', line 21 def user_agent @env['HTTP_USER_AGENT'] end |