Value
A single cookie (key/value pair).
struct Value
A single cookie (key/value pair).
struct Value
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
struct HTTPCookies
A collection of HTTPCookie
s.
init()
Creates an empty HTTPCookies
init(dictionaryLiteral elements: (String, Value)...)
See ExpressibleByDictionaryLiteral
.
var all: [String : Value] { get set }
All cookies.
subscript(name: String) -> Value? { get set }
Access HTTPCookies
by name
enum SameSitePolicy
A cookie which can only be sent in requests originating from the same origin as the target domain.
protocol ExpressibleByExtendedGraphemeClusterLiteral : ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single extended grapheme cluster.
protocol ExpressibleByStringLiteral : ExpressibleByExtendedGraphemeClusterLiteral
A type that can be initialized with a string literal.
protocol ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single Unicode scalar value.
protocol Sendable
init(string: String, expires: Date? = nil, maxAge: Int? = nil, domain: String? = nil, path: String? = "/", isSecure: Bool = false, isHTTPOnly: Bool = false, sameSite: SameSitePolicy? = .lax)
Creates a new HTTPCookieValue
.
init(stringLiteral value: String)
See ExpressibleByStringLiteral
.
static let expired: Value
An expired HTTPCookieValue
.
var domain: String?
The affected domain at which the cookie is active.
var expires: Date?
The cookie’s expiration date
var isHTTPOnly: Bool
Does not expose the cookie over non-HTTP channels.
var isSecure: Bool
Limits the cookie to secure connections.
var maxAge: Int?
The maximum cookie age in seconds.
var path: String?
The path at which the cookie is active.
var sameSite: SameSitePolicy?
A cookie which can only be sent in requests originating from the same origin as the target domain.
var string: String
The cookie’s value.
func serialize(name: String) -> String
Serializes an HTTPCookie
to a String
.
init(extendedGraphemeClusterLiteral value: Self.StringLiteralType)
init(unicodeScalarLiteral value: Self.ExtendedGraphemeClusterLiteralType)