first(name:)

Retrieves the first value for a given header field name from the block.

HTTPTypes.swift:467
func first(name: String) -> String?

Parameters

name

The header field name whose first value should be retrieved.

Returns

The first value for the header field name.

This method uses case-insensitive comparisons for the header field name. It does not return the first value from a maximally-decomposed list of the header fields, but instead returns the first value from the original representation: that means that a comma-separated header field list may contain more than one entry, some of which contain commas and some do not. If you want a representation of the header fields suitable for performing computation on, consider subscript(canonicalForm:).