Data object ICookie
interface struct ICookie
This interface represents an HTTP cookie with its associated properties.
It is extensible and follows the HTTP Cookie specification. Refer RFC 6265.
Fields
name
string — Required
Cookie name.
The name attribute of the cookie as defined in RFC 6265.
It must not be empty and should not contain control characters.
Example: “sessionId”
value
string — Required
Cookie value.
The value attribute of the cookie as defined in RFC 6265.
It may be empty.
Example: “abc123xyz”
path
string? — Optional
Cookie path.
The path attribute of the cookie as defined in RFC 6265 Section 5.2.4.
It is optional and could be null.
It specifies the scope of the cookie to a specific path on the server.
If null, it defaults to the path of the request that generated the cookie.
Example: ”/“
domain
string? — Optional
Cookie domain.
The domain attribute of the cookie as defined in RFC 6265 Section 5.2.3.
It is optional and could be null.
It specifies the domain for which the cookie is valid. If specified,
the cookie would be sent to that domain and all its subdomains.
If null, the cookie is only sent to the origin server.
Example: “.example.com”
expires
string? — Optional
Cookie expiration date and time.
The expires attribute of the cookie as defined in RFC 6265 Section 5.2.1.
It specifies the maximum lifetime of the cookie as an HTTP date timestamp.
If null, the cookie is a session cookie and gets deleted when the session ends.
It should follow HTTP date format i.e. “EEE, dd MMM yyyy HH:mm:ss GMT”
Example: “Wed, 31 Dec 2025 23:59:59 GMT”
secure
bool — Required
Secure flag for cookie.
The Secure attribute of the cookie as defined in RFC 6265 Section 5.2.5.
When true, the cookie is only sent over HTTPS connections,
providing protection against man-in-the-middle attacks.
httpOnly
bool — Required
HttpOnly flag for cookie.
The HttpOnly attribute of the cookie as defined in RFC 6265 Section 5.2.6.
When true, the cookie is inaccessible to JavaScript’s Document.cookie API,
providing protection against cross-site scripting (XSS) attacks.
