---
title: "addValue(_:forHTTPHeaderField:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlrequest/addvalue(_:forhttpheaderfield:)"
---

# addValue(_:forHTTPHeaderField:)

Adds a value to the header field.

## Declaration

```swift
mutating func addValue(_ value: String, forHTTPHeaderField field: String)
```

## Parameters

- `value`: The value for the header field.
- `field`: The name of the header field. In keeping with the HTTP RFC, HTTP header field names are case insensitive.

## Discussion

Discussion This method provides the ability to add values to header fields incrementally. If a value was previously set for the specified field, the supplied value is appended to the existing value using the appropriate field delimiter (a comma). Certain header fields are reserved (see Reserved HTTP headers). Do not use this method to change such headers.

## See Also

### Accessing header fields

- [allHTTPHeaderFields](foundation/urlrequest/allhttpheaderfields.md)
- [setValue(_:forHTTPHeaderField:)](foundation/urlrequest/setvalue(_:forhttpheaderfield:).md)
- [value(forHTTPHeaderField:)](foundation/urlrequest/value(forhttpheaderfield:).md)
