Sha256: 8c380f6ade612f7366cd88e7667809debfe1d854ceb037c9ae7d80567294529b
Contents?: true
Size: 766 Bytes
Versions: 2
Compression:
Stored size: 766 Bytes
Contents
require "accept_headers/encoding" require "accept_headers/negotiatable" module AcceptHeaders class Encoding class Negotiator include Negotiatable private def parse(original_header) header = original_header.dup header.sub!(/\AAccept-Encoding:\s*/, '') header.strip! return [Encoding.new] if header.empty? encodings = [] header.split(',').each do |entry| encoding_arr = entry.split(';', 2) next if encoding_arr[0].nil? encoding = TOKEN_PATTERN.match(encoding_arr[0]) next if encoding.nil? encodings << Encoding.new(encoding[:token], q: parse_q(encoding_arr[1])) end encodings.sort! { |x,y| y <=> x } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
accept_headers-0.0.4 | lib/accept_headers/encoding/negotiator.rb |
accept_headers-0.0.3 | lib/accept_headers/encoding/negotiator.rb |