Header
public struct Header : Hashable
A header in a HTTP request. A header consists of a series of fields containing a key and a value. Keys are
represented by the Field.Name type while values are simply Strings.
Note
AHeader instance does not preserve the order of fields added to it.
-
A dictionary representation of the header.
Declaration
Swift
public var dictionaryValue: [String : String] { get } -
trueif the header is empty.Declaration
Swift
public var isEmpty: Bool { get }
-
Initializes a new
Headercontaining the provided fields.Declaration
Swift
public init(_ fields: [Field])Parameters
fieldsThe fields to initialize the header with.
-
An empty header.
Declaration
Swift
public static var empty: Header { get }
-
Adds
fieldinto the header. If a field with the same name already exists, its value is joined withfield‘s value using a,.Declaration
Swift
public mutating func add(_ field: Field) -
Sets
fieldin the header, replacing any existing values.Declaration
Swift
public mutating func set(_ field: Field) -
Returns
trueif the header contains a value for the field namedfield.Declaration
Swift
public func contains(_ name: Field.Name) -> Bool
-
Accesses the value of the header field matching
name.Declaration
Swift
public subscript(name: Field.Name) -> String? { get set }
-
Undocumented
Declaration
Swift
public init(_ fields: Field...)
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public init(arrayLiteral elements: Field...)
View on GitHub
Header Structure Reference