HTTPCookies
open class HTTPCookies : ObjectBase
Encapsulates a map of HTTP cookies.
-
An immutable empty map of HTTP cookies.
Declaration
Swift
public static let empty: HTTPCookies
-
Default initializer.
Declaration
Swift
override public init()
-
Add all of the cookies from another cookies object into this cookies object.
Declaration
Swift
open func addAll(other: HTTPCookies)
Parameters
other
Another cookies object.
-
Declaration
Swift
open func concurrent() -> HTTPCookies
Return Value
This cookies object, configured to allow safe concurrent read/write access.
-
Declaration
Swift
open func cookie(withName name: String) -> String?
Parameters
name
Cookie name.
Return Value
The value of a cookie, or
nil
if not found. -
Declaration
Swift
open func copy() -> HTTPCookies
Return Value
A copy of these cookies.
-
Declaration
Swift
open func entries() -> StringMap.EntryList
Return Value
The cookie entries (name/value pairs).
-
Declaration
Swift
open func hasCookie(withName name: String) -> Bool
Parameters
name
Cookie name.
Return Value
true
if a specified cookie exists. -
true
if this map is empty.Declaration
Swift
open var isEmpty: Bool { get }
-
Declaration
Swift
open func keys() -> StringList
Return Value
The cookie names.
-
Clear all the cookies.
Declaration
Swift
open func removeAll()
-
Remove the value of a cookie, if present.
Declaration
Swift
open func removeCookie(withName name: String) -> Bool
Parameters
name
Cookie name.
Return Value
true
if a cookie was deleted. -
Set the value of a cookie.
Declaration
Swift
open func setCookie(withName name: String, value: String)
Parameters
name
Cookie name.
value
Cookie value.
-
The number of cookies.
Declaration
Swift
open var size: Int { get }
-
Declaration
Swift
open func sortedEntries() -> StringMap.EntryList
Return Value
The cookie entries (name/value pairs) sorted by name (case insensitive).
-
Declaration
Swift
open func sortedKeys() -> StringList
Return Value
The cookie names in sorted order.
-
Declaration
Swift
override open func toString() -> String
Return Value
Cookies as a JSON string.