In an attempt to help users with sometimes unknown HTTP headers and provide a consistent API across the system networking type, I've created a PR that adds a concrete
HTTPHeaders type, as well as a simple
This implementation seeks a balance between convenient high-level APIs, simple implementation, and integration with
URLSessionConfiguration, which all have different property names and sometimes different types for the headers. The
HTTPHeaders type allows conversion to and from
[String: String] to integrate with these APIs.
HTTPHeaders allows for simple high-level usage, being both
ExpressibleByDictionaryLiteral, giving us an API like this:
let headers: HTTPHeaders = ["Content-Type": "application/json"]
and, with the right static constructors:
let headers: HTTPHeaders = [.contentType("application/json")]
So this RFC seek input on the API surface offered and desired features for such a type. While code level comments can be left on the PR, API or theoretical discussions are likely better here.