Skip to content

Conversation

swhitty
Copy link
Owner

@swhitty swhitty commented Sep 13, 2025

Replaces dictionary representations of headers [HTTPHeader: String] with a type HTTPHeaders which continues to support subscript and dictionary literal API

let response = HTTPResponse(headers: [.contentEncoding: "xml"])

response.headers[.contentEncoding] // "xml"

But also supports appending multiple values which

var headers = HTTPHeaders()

headers.addValue("fish" for: .setCookie)
headers.addValue("chips" for: .setCookie)

response.headers.values(for: .setCookie) == [
  (header: .setCookie, value: "fish"),
  (header: .setCookie, value: "chips"),
]

It continues to support combining (supported) headers into a comma delimited value

var headers = HTTPHeaders()

headers.addValue("xml" for: .contentEncoding)
headers.addValue("html" for: .contentEncoding)

response.headers[.contentEncoding] // "xml, html"

Copy link

codecov bot commented Sep 13, 2025

Codecov Report

❌ Patch coverage is 87.96296% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.47%. Comparing base (7e5974e) to head (7393833).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
FlyingFox/Sources/HTTPHeaders.swift 80.64% 12 Missing ⚠️
FlyingFox/Sources/HTTPRequest.swift 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #173      +/-   ##
==========================================
- Coverage   93.63%   93.47%   -0.17%     
==========================================
  Files          63       64       +1     
  Lines        4275     4365      +90     
==========================================
+ Hits         4003     4080      +77     
- Misses        272      285      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@swhitty swhitty merged commit 6ae094d into main Sep 13, 2025
32 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to send multiple headers with the same name (for example Set-Cookie)
1 participant