subscript(_:)

Access the field value string by name.

HTTPFields.swift:166
subscript(name: HTTPField.Name) -> String? { get set }

Example:

// Set a header field in the request.
request.headerFields[.accept] = "*/*"

// Access a header field value from the response.
let contentTypeValue = response.headerFields[.contentType]

If multiple fields with the same name exist, they are concatenated with commas (or semicolons in the case of the “Cookie” header field).

When setting a “Cookie” header field value, it is split into multiple “Cookie” fields by semicolon.