subscript(_:)
HTTPTypes.swift:572subscript(position: HTTPHeaders.Index) -> HTTPHeaders.Element { get }
subscript(position: HTTPHeaders.Index) -> HTTPHeaders.Element { get }
import NIOHTTP1
struct HTTPHeaders
A representation of a block of HTTP header fields.
struct Index
typealias Element = (name: String, value: String)
init(_ headers: [(String, String)] = [])
Construct a HTTPHeaders
structure.
init(dictionaryLiteral elements: (String, String)...)
Construct a HTTPHeaders
structure.
var capacity: Int { get }
The total number of headers that can be contained without allocating new storage.
var description: String { get }
var endIndex: HTTPHeaders.Index { get }
var startIndex: HTTPHeaders.Index { get }
subscript(name: String) -> [String] { get }
Retrieve all of the values for a give header field name from the block.
subscript(canonicalForm name: String) -> [Substring] { get }
Retrieves the header values for the given header field in “canonical form”: that is, splitting them on commas as extensively as possible such that multiple values received on the one line are returned as separate entries. Also respects the fact that Set-Cookie should not be split in this way.
static func == (lhs: HTTPHeaders, rhs: HTTPHeaders) -> Bool
mutating func add(contentsOf other: HTTPHeaders)
Add another block of headers to the block.
mutating func add<S>(contentsOf other: S) where S : Sequence, S.Element == (String, String)
Add a sequence of header name/value pairs to the block.
mutating func add(name: String, value: String)
Add a header name/value pair to the block.
func contains(name: String) -> Bool
Checks if a header is present
func first(name: String) -> String?
Retrieves the first value for a given header field name from the block.
func index(after i: HTTPHeaders.Index) -> HTTPHeaders.Index
func index(before i: HTTPHeaders.Index) -> HTTPHeaders.Index
mutating func remove(name: String)
Remove all values for a given header name from the block.
mutating func replaceOrAdd(name: String, value: String)
Add a header name/value pair to the block, replacing any previous values for the same header name that are already in the block.
mutating func reserveCapacity(_ minimumCapacity: Int)
Reserves enough space to store the specified number of headers.