Protocol::HTTPSourceProtocolHTTPHeaderAcceptEncoding

class AcceptEncoding

The accept-encoding header represents a list of encodings that the client can accept.

Definitions

QVALUE = /0(\.[0-9]{0,3})?|1(\.[0]{0,3})?/

https://tools.ietf.org/html/rfc7231#section-5.3.1

ENCODING = /\A(?<name>#{TOKEN})(;q=(?<q>#{QVALUE}))?\z/

https://tools.ietf.org/html/rfc7231#section-5.3.4

def encodings

Parse the accept-encoding header value into a list of encodings.

Signature

returns Array(Charset)

the list of character sets and their associated quality factors.

Implementation

def encodings
	self.map do |value|
		if match = value.match(ENCODING)
			Encoding.new(match[:name], match[:q])
		else
			raise ParseError.new("Could not parse encoding: #{value.inspect}")
		end
	end
end