All HTTP header fields of the response.
SDKs
- iOS 2.0+
- macOS 10.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
var allHeaderFields: [Any Hashable : 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(for
method instead.