RequestHeaders
public struct RequestHeaders : ExpressibleByDictionaryLiteral, Equatable, Hashable, CustomStringConvertible
RequestHeaders
is a value type that stores mapping of header keys an their values.
It is sent with a Request
and recieved with a RequestResponse
See the the nested Key
and Value
types for more detailed information.
You can create a RequestHeaders
using a dictionary litera containing those types.
-
Create an empty header with no keys and values
Declaration
Swift
public init()
-
A
RequestHeaders.Key
is a value type used to describe keys in a header dictionary.You can create headers in a few ways:
- Using any type that conforms to
RawRepresentable
whereRawValue
isString
- Using any type that conforms to
CustomStringConvertible
- Using strings or string literals
Commonly used values and additional factory methods are declared in an extension to reduce boilerplate and increase type safety.
See moreDeclaration
Swift
public struct Key : ExpressibleByStringLiteral, Equatable, Hashable, CustomStringConvertible
- Using any type that conforms to
-
A
RequestHeaders.Value
is a value type used to describe values in a header dictionary.You can create values in a few ways:
- Using any type that conforms to
RawRepresentable
whereRawValue
isString
- Using any type that conforms to
CustomStringConvertible
- Using strings or string literals
- Using integer literals
- Using floating point literals
Commonly used values and additional factory methods are declared in an extension to reduce boilerplate and increase type safety.
See moreDeclaration
Swift
public struct Value : ExpressibleByStringLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, CustomStringConvertible, Equatable, Hashable
- Using any type that conforms to
-
Remove a value for a key
Declaration
Swift
public mutating func removeValue(forKey key: Key)
Parameters
key
The key
-
Returns the result of combining the elements of the sequence using the given closure.
Throws
Error from the reduction closureDeclaration
Parameters
initialResult
The value to use as the initial accumulating value.
initialResult
is passed tonextPartialResult
the first time the closure is executed.nextPartialResult
A closure that combines an accumulating value and an element of the sequence into a new accumulating value, to be used in the next call of the
nextPartialResult
closure or returned to the caller.Return Value
The reduced value
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public static func == (lhs: RequestHeaders, rhs: RequestHeaders) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)