From 7bc4353cb058c7f2b2cd374925a31a2e223cc5d2 Mon Sep 17 00:00:00 2001 From: Xyan Bhatnagar Date: Tue, 24 Feb 2026 12:31:31 -0800 Subject: [PATCH] Fix bug with response header creation When converting the AHC headers to the HTTP API compatible headers, headers with the same name and different values should be inserted instead of being replaced. This change now allows AHC to pass some header conformance tests. --- Sources/AsyncHTTPClient/HTTP APIs/AHC+HTTP.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/AsyncHTTPClient/HTTP APIs/AHC+HTTP.swift b/Sources/AsyncHTTPClient/HTTP APIs/AHC+HTTP.swift index 8ab99dd48..a6b485605 100644 --- a/Sources/AsyncHTTPClient/HTTP APIs/AHC+HTTP.swift +++ b/Sources/AsyncHTTPClient/HTTP APIs/AHC+HTTP.swift @@ -217,7 +217,8 @@ extension AsyncHTTPClient.HTTPClient: HTTPAPIs.HTTPClient { var responseFields = HTTPFields() for (name, value) in ahcResponse.headers { if let name = HTTPField.Name(name) { - responseFields[name] = value + // Add a new header field + responseFields.append(.init(name: name, value: value)) } }