Skip to content

class HTTP::Cookie
inherits Reference

Represents a cookie with all its attributes. Provides convenient access and modification of them.

Class methods

.new(name : String, value : String, path : String? = nil, expires : Time? = nil, domain : String? = nil, secure : Bool = false, http_only : Bool = false, samesite : SameSite? = nil, extension : String? = nil)

Creates a new Cookie instance.

Raises IO::Error if name or value are invalid as per RFC 6265 §4.1.1.

View source

Methods

#==(other : self)

Returns true if this reference is the same as other. Invokes same?.

#domain : String?

View source

#domain=(domain : String?)

View source

#expired?

View source

#expires : Time?

View source

#expires=(expires : Time?)

View source

#extension : String?

View source

#extension=(extension : String?)

View source

#hash(hasher)

#http_only : Bool

View source

#http_only=(http_only : Bool)

View source

#name=(name : String)

Sets the name of this cookie.

Raises IO::Error if the value is invalid as per RFC 6265 §4.1.1.

View source

#path=(path : String?)

View source

#samesite : SameSite?

View source

#samesite=(samesite : SameSite?)

View source

#secure : Bool

View source

#secure=(secure : Bool)

View source
View source
View source
View source

#value : String

View source

#value=(value : String)

Sets the value of this cookie.

Raises IO::Error if the value is invalid as per RFC 6265 §4.1.1.

View source