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 = HTTPCookies._new1_in_HTTPCookies(StringMap.empty)
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Declaration

    Swift

    open func concurrent() -> HTTPCookies

    Return Value

    a thread-safe cookies object that delegates to this cookies object. A regular HttpCookies object is not thread-safe for concurrent read/write access. This function will return a thread-safe wrapper.

  • 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.

  • Declaration

    Swift

    open func keys() -> StringList

    Return Value

    The cookie names.

  • Clear all the cookies.

    Declaration

    Swift

    open func removeAll() -> Void
  • Delete 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) -> Void

    Parameters

    name

    Cookie name.

    value

    Cookie value.

  • The number of cookies.

    Declaration

    Swift

    open var size: Int
  • Declaration

    Swift

    open func sortedEntries() -> StringMap.EntryList

    Return Value

    The cookie entries (name/value pairs) sorted by name (case insensitive).

  • Declaration

    Swift

    override open func toString() -> String

    Return Value

    Cookies as a JSON string.