HTTPHeaders
open class HTTPHeaders : ObjectBase, @unchecked Sendable
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
otherAnother headers object.
-
Declaration
Swift
open func concurrent() -> HTTPHeadersReturn Value
This headers object, configured to allow safe concurrent read/write access.
-
Declaration
Swift
open func copy() -> HTTPHeadersReturn Value
A copy of these headers.
-
Construct an empty HttpHeaders if the
headersparameter isnil.Declaration
Swift
open class func emptyIfNull(headers: HTTPHeaders?) -> HTTPHeadersParameters
headersHttpHeaders to be checked.
Return Value
The
headersparameter, if non-nil. Otherwise an empty HttpHeaders. -
Declaration
Swift
open func entries() -> StringMap.EntryListReturn Value
The header entries (name/value pairs).
-
Compare this HttpHeaders keys/values with another HttpHeaders keys/values for equality.
Declaration
Swift
open func equals(_ other: AnyObject?) -> BoolParameters
otherThe 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) -> BoolParameters
nameHeader name.
Return Value
trueif a specified header exists. -
See also
PearsonHashing.Declaration
Swift
open func hashCode() -> IntReturn Value
A hash code for this HttpHeaders.
-
Declaration
Swift
open func header(withName name: String) -> String?Parameters
nameHeader name.
Return Value
The value of a header, or
nilif not found. -
trueif this map is empty.Declaration
Swift
open var isEmpty: Bool { get } -
Declaration
Swift
open func keys() -> StringListReturn Value
The header names.
-
Clear all the headers.
Declaration
Swift
open func removeAll() -
Remove the value of a header, if present.
Declaration
Swift
open func removeHeader(withName name: String) -> BoolParameters
nameHeader name.
Return Value
trueif a header was removed. -
Set the value of a header.
Declaration
Swift
open func setHeader(withName name: String, value: String)Parameters
nameHeader name.
valueHeader value.
-
The number of headers.
Declaration
Swift
open var size: Int { get } -
Declaration
Swift
open func sortedEntries() -> StringMap.EntryListReturn Value
The header entries (name/value pairs) sorted by name (case insensitive).
-
Declaration
Swift
open func sortedKeys() -> StringListReturn Value
The header names in sorted order.
-
Declaration
Swift
override open func toString() -> StringReturn Value
Headers as a JSON string.
-
Declaration
Swift
open func toStringLowerCaseKeys() -> StringReturn 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) -> HTTPHeadersParameters
credentialsClient credentials.
Return Value
This object.
-
Equivalent to
withData("X-Create-Parameters", value).Declaration
Swift
open func withCreateParameters(_ parameters: StructureBase) -> HTTPHeadersParameters
parametersCreate parameters.
Return Value
This object.
-
Convert
valueto 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?) -> HTTPHeadersParameters
headerHeader name.
valueHeader value.
Return Value
This object.
-
Equivalent to
withData("X-Delete-Parameters", parameters).Declaration
Swift
open func withDeleteParameters(_ parameters: StructureBase) -> HTTPHeadersParameters
parametersDelete parameters.
Return Value
This object.
-
Set the value of a header.
Declaration
Swift
open func withHeader(_ name: String, value: String) -> HTTPHeadersParameters
nameHeader name.
valueHeader value.
Return Value
This object.
-
Equivalent to
withData("X-Update-Parameters", value).Declaration
Swift
open func withUpdateParameters(_ parameters: StructureBase) -> HTTPHeadersParameters
parametersUpdate parameters.
Return Value
This object.