lib/rackful/request.rb
Hash of acceptable media types and their qualities.

This method parses the HTTP/1.1 `Accept:` header. If no acceptable media
types are provided, an empty Hash is returned.
@return [Hash{media_type => quality}]
Hash of acceptable media types and their qualities.
This method parses the HTTP/1.1 `Accept:` header. If no acceptable media
types are provided, an empty Hash is returned.
Hash of acceptable media types and their qualities . This method parses the HTTP / 1 . 1 ` Accept : ` header . If no acceptable media types are provided an empty Hash is returned .
def accept
    @env['rackful.accept'] ||= begin
      Hash[
        @env['HTTP_ACCEPT'].to_s.split(',').collect do
          |entry|
          type, *options = entry.delete(' ').split(';')
          quality = 1
          options.each { |e|
            quality = e[2..-1].to_f if e.start_with? 'q='
          }
          [type, quality]
        end
      ]
    rescue
      {}
    end
  end
def accept @env [ 'rackful.accept' ] ||= begin Hash [ @env [ 'HTTP_ACCEPT' ] . to_s . split ( ',' ) . collect do | entry | type , * options = entry . delete ( ' ' ) . split ( ';' ) quality = 1 options . each { | e | quality = e [ 2 .. - 1 ] . to_f if e . start_with? 'q=' } [ type , quality ] end ] rescue { } end end
Hash of acceptable media types and their qualities.
Hash of acceptable media types and their qualities .
None
Hash{media_type => quality}