<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLRequest/value(forHTTPHeaderField:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation10URLRequestV5value18forHTTPHeaderFieldSSSgSS_tF"
  },
  "title" : "value(forHTTPHeaderField:)"
}
-->

# value(forHTTPHeaderField:)

Retrieves a header value.

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

## Parameters

`field`

The header field name to use for the lookup (case-insensitive).

## Return Value

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

## Discussion

Note that, 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)