HTTPHeaders

open class HTTPHeaders : ObjectBase

Encapsulates a map of HTTP headers, allowing case-insensitive lookup.

  • An immutable empty map of HTTP headers.

    Declaration

    Swift

    public static let empty: HTTPHeaders
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Add all of the headers from another headers object into this headers object.

    Declaration

    Swift

    open func addAll(other: HTTPHeaders)

    Parameters

    other

    Another headers object.

  • Declaration

    Swift

    open func concurrent() -> HTTPHeaders

    Return Value

    a thread-safe headers object that delegates to self headers object. An HttpHeaders object is not thread-safe for concurrent read/write access. This function will return a thread-safe wrapper.

  • Declaration

    Swift

    open func copy() -> HTTPHeaders

    Return Value

    A copy of these headers.

  • Construct an empty HttpHeaders if the headers parameter is nil.

    Declaration

    Swift

    open class func emptyIfNull(headers: HTTPHeaders?) -> HTTPHeaders

    Parameters

    headers

    HttpHeaders to be checked.

    Return Value

    The headers parameter, if non-nil. Otherwise an empty HttpHeaders.

  • Declaration

    Swift

    open func entries() -> StringMap.EntryList

    Return Value

    The header entries (name/value pairs).

  • Compare this HttpHeaders keys/values with another HttpHeaders keys/values for equality.

    Declaration

    Swift

    open func equals(_ value: AnyObject?) -> Bool

    Parameters

    value

    The other HttpHeaders.

    Return Value

    True, if the two HttpHeaders have same size and all corresponding keys/values are equal. Otherwise false.

  • Declaration

    Swift

    open func hasHeader(withName name: String) -> Bool

    Parameters

    name

    Header name.

    Return Value

    true if a specified header exists.

  • See also

    PearsonHashing.

    Declaration

    Swift

    open func hashCode() -> Int

    Return Value

    A hash code for this HttpHeaders.

  • Declaration

    Swift

    open func header(withName name: String) -> String?

    Parameters

    name

    Header name.

    Return Value

    The value of a header, or nil if not found.

  • Declaration

    Swift

    open func keys() -> StringList

    Return Value

    The header names.

  • Clear all the headers.

    Declaration

    Swift

    open func removeAll()
  • Delete the value of a header, if present.

    Declaration

    Swift

    open func removeHeader(withName name: String) -> Bool

    Parameters

    name

    Header name.

    Return Value

    true if a cookie was deleted.

  • Set the value of a header.

    Declaration

    Swift

    open func setHeader(withName name: String, value: String)

    Parameters

    name

    Header name.

    value

    Header value.

  • The number of headers.

    Declaration

    Swift

    open var size: Int { get }
  • Declaration

    Swift

    open func sortedEntries() -> StringMap.EntryList

    Return Value

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

  • Declaration

    Swift

    open func sortedKeys() -> StringList

    Return Value

    The header names in sorted order.

  • Declaration

    Swift

    override open func toString() -> String

    Return Value

    Headers as a JSON string.

  • Declaration

    Swift

    open func toStringLowerCaseKeys() -> String

    Return Value

    Headers as a JSON string, that the key field is lower case.

  • Equivalent to withData("X-Client-Credentials", value).

    Declaration

    Swift

    open func withClientCredentials(_ credentials: StructureBase) -> HTTPHeaders

    Parameters

    credentials

    Client credentials.

    Return Value

    This object.

  • Equivalent to withData("X-Create-Parameters", value).

    Declaration

    Swift

    open func withCreateParameters(_ parameters: StructureBase) -> HTTPHeaders

    Parameters

    parameters

    Create parameters.

    Return Value

    This object.

  • Convert value to OData 4.0 JSON format, then set a header with the JSON-encoded value as a data URI with media type “application/json” and base64-encoded data.

    Declaration

    Swift

    open func withData(header: String, value: AnyObject?) -> HTTPHeaders

    Parameters

    header

    Header name.

    value

    Header value.

    Return Value

    This object.

  • Equivalent to withData("X-Delete-Parameters", parameters).

    Declaration

    Swift

    open func withDeleteParameters(_ parameters: StructureBase) -> HTTPHeaders

    Parameters

    parameters

    Delete parameters.

    Return Value

    This object.

  • Set the value of a header.

    Declaration

    Swift

    open func withHeader(_ name: String, value: String) -> HTTPHeaders

    Parameters

    name

    Header name.

    value

    Header value.

    Return Value

    This object.

  • Equivalent to withData("X-Update-Parameters", value).

    Declaration

    Swift

    open func withUpdateParameters(_ parameters: StructureBase) -> HTTPHeaders

    Parameters

    parameters

    Update parameters.

    Return Value

    This object.

  • Credentials for HTTP Basic Authorization.

    See more

    Declaration

    Swift

    open class BasicAuth : ObjectBase