class SetCookie < Multiple
- Inherits from
Multiple: #to_s, .parse, .coerce
The set-cookie header sends cookies from the server to the user agent.
Each Set-Cookie header must be a separate header field — they cannot be combined.
It is used to store cookies on the client side, which are then sent back to the server
in subsequent requests using the cookie header.
Definitions
def to_h
Parses the set-cookie headers 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::Cookieobjects.
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.
Signature
-
returns
Boolean false, as set-cookie headers are needed during initial response processing.
Implementation
def self.trailer?
false
end