HeadersContainer
public class HeadersContainer
extension HeadersContainer: Collection
A class that abstracts out the HTTP header APIs of the ServerRequest and
ServerResponse protocols.
-
Create an instance of
HeadersContainerDeclaration
Swift
public init() -
Access the value of a HTTP header using subscript syntax.
Declaration
Swift
public subscript(key: String) -> [String]? { get set }Parameters
keyThe HTTP header key
Return Value
An array of strings representing the set of values for the HTTP header key. If the HTTP header is not found, nil will be returned.
-
Append values to an HTTP header
Declaration
Swift
public func append(_ key: String, value: [String])Parameters
keyThe HTTP header key
valueAn array of strings to add as values of the HTTP header
-
Append values to an HTTP header
Declaration
Swift
public func append(_ key: String, value: String)Parameters
keyThe HTTP header key
valueA string to be appended to the value of the HTTP header
-
Remove all of the headers
Declaration
Swift
public func removeAll() -
Declaration
Swift
public typealias Index = DictionaryIndex<String, (key: String, value: [String])> -
The starting index of the
HeadersContainercollectionDeclaration
Swift
public var startIndex: Index { get } -
The ending index of the
HeadersContainercollectionDeclaration
Swift
public var endIndex: Index { get } -
Get a (key value) tuple from the
HeadersContainercollection at the specified position.Declaration
Swift
public subscript(position: Index) -> (key: String, value: [String]) { get }Parameters
positionThe position in the
HeadersContainercollection of the (key, value) tuple to return.Return Value
A (key, value) tuple.
View on GitHub
HeadersContainer Class Reference