<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/HTTPURLResponse/value(forHTTPHeaderField:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSHTTPURLResponse(im)valueForHTTPHeaderField:"
  },
  "title" : "value(forHTTPHeaderField:)"
}
-->

# value(forHTTPHeaderField:)

Returns the value that corresponds to the given header field.

```
func value(forHTTPHeaderField field: String) -> String?
```

## Parameters

`field`

The name of the header field you want to retrieve. The name is case-insensitive.

## Return Value

The value associated with the given header field, or `nil` if no value is associated with the field.

## Discussion

In keeping with the HTTP RFC, HTTP header field names are case-insensitive.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)