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.
- #forwarded? ⇒ Boolean
- #path_info=(value) ⇒ Object
- #route ⇒ Object
Instance Method Details
#accept ⇒ Object
Returns an array of acceptable media types for the response
16 17 18 |
# File 'lib/sinatra/base.rb', line 16 def accept @env['HTTP_ACCEPT'].to_s.split(',').map { |a| a.split(';')[0].strip } end |
#forwarded? ⇒ Boolean
32 33 34 |
# File 'lib/sinatra/base.rb', line 32 def forwarded? @env.include? "HTTP_X_FORWARDED_HOST" end |
#path_info=(value) ⇒ Object
43 44 45 46 |
# File 'lib/sinatra/base.rb', line 43 def path_info=(value) @route = nil super end |
#route ⇒ Object
36 37 38 39 40 41 |
# File 'lib/sinatra/base.rb', line 36 def route @route ||= begin path = Rack::Utils.unescape(path_info) path.empty? ? "/" : path end end |