Instance Property

allHeaderFields

All HTTP header fields of the response.

Declaration

var allHeaderFields: [AnyHashable : Any] { get }

Discussion

The value of this property is a dictionary that contains all the HTTP header fields received as part of the server’s response. By examining this dictionary, clients can see the “raw” header information returned by the HTTP server.

The keys in this dictionary are the header field names, as received from the server. See RFC 2616 for a list of commonly used HTTP header fields.

HTTP headers are case insensitive. To simplify your code, URL Loading System canonicalizes certain header field names into their standard form. For example, if the server sends a content-length header, it’s automatically adjusted to be Content-Length.

Because this property is a standard Swift dictionary, its keys are case-sensitive. To perform a case-insensitive header lookup, use the value(forHTTPHeaderField:) method instead.

See Also

Getting HTTP Response Headers

func value(forHTTPHeaderField: String) -> String?

Returns the value that corresponds to the given header field.