class Sinatra::Request
rubydoc.info/github/rack/rack/master/Rack/Request<br>The request object. See Rack::Request for more info:
def accept
def accept @env['sinatra.accept'] ||= begin if @env.include? 'HTTP_ACCEPT' and @env['HTTP_ACCEPT'].to_s != '' @env['HTTP_ACCEPT'].to_s.scan(HEADER_VALUE_WITH_PARAMS). map! { |e| AcceptEntry.new(e) }.sort else [AcceptEntry.new('*/*')] end end end
def accept?(type)
def accept?(type) preferred_type(type).to_s.include?(type) end
def forwarded?
def forwarded? @env.include? "HTTP_X_FORWARDED_HOST" end
def idempotent?
def idempotent? safe? or put? or delete? or link? or unlink? end
def link?
def link? request_method == "LINK" end
def params
def params super rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e raise BadRequest, "Invalid query parameters: #{Rack::Utils.escape_html(e.message)}" rescue EOFError => e raise BadRequest, "Invalid multipart/form-data: #{Rack::Utils.escape_html(e.message)}" end
def preferred_type(*types)
def preferred_type(*types) return accept.first if types.empty? types.flatten! return types.first if accept.empty? accept.detect do |accept_header| type = types.detect { |t| MimeTypeEntry.new(t).accepts?(accept_header) } return type if type end end
def safe?
def safe? get? or head? or options? or trace? end
def unlink?
def unlink? request_method == "UNLINK" end