Protocol::HTTPSourceProtocolHTTPHeaderCookie

class Cookie

The cookie header contains stored HTTP cookies previously sent by the server with the set-cookie header.

It is used by clients to send key-value pairs representing stored cookies back to the server.

Definitions

def to_h

Parses the cookie header into a hash of cookie names and their corresponding cookie objects.

Signature

returns Hash(String, HTTP::Cookie)

a hash where keys are cookie names and values are class Protocol::HTTP::Cookie objects.

Implementation

def to_h
	cookies = self.collect do |string|
		HTTP::Cookie.parse(string)
	end
	
	cookies.map{|cookie| [cookie.name, cookie]}.to_h
end

def self.trailer?

Whether this header is acceptable in HTTP trailers. Cookie headers should not appear in trailers as they contain state information needed early in processing.

Signature

returns Boolean

false, as cookie headers are needed during initial request processing.

Implementation

def self.trailer?
	false
end