Rack::Request
The request object. See Rack::Request for more info: rack.rubyforge.org/doc/classes/Rack/Request.html
Returns an array of acceptable media types for the response
# File lib/sinatra/base.rb, line 20 def accept @env['sinatra.accept'] ||= begin entries = @env['HTTP_ACCEPT'].to_s.split(',') entries.map { |e| accept_entry(e) }.sort_by(&:last).map(&:first) end end
# File lib/sinatra/base.rb, line 48 def forwarded? @env.include? "HTTP_X_FORWARDED_HOST" end
# File lib/sinatra/base.rb, line 56 def path_info=(value) @route = nil super end
# File lib/sinatra/base.rb, line 27 def preferred_type(*types) return accept.first if types.empty? types.flatten! accept.detect do |pattern| type = types.detect { |t| File.fnmatch(pattern, t) } return type if type end end
# File lib/sinatra/base.rb, line 52 def route @route ||= Rack::Utils.unescape(path_info) end
Whether or not the web server (or a reverse proxy in front of it) is using SSL to communicate with the client.
# File lib/sinatra/base.rb, line 39 def secure? @env['HTTPS'] == 'on' or @env['HTTP_X_FORWARDED_PROTO'] == 'https' or @env['rack.url_scheme'] == 'https' end
Generated with the Darkfish Rdoc Generator 2.