mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
Fix Httpclient headers from being modified accidentally (#17808)
(cherry picked from commit f1ce173283)
This commit is contained in:
@@ -958,12 +958,15 @@ proc format(client: HttpClient | AsyncHttpClient,
|
||||
|
||||
proc override(fallback, override: HttpHeaders): HttpHeaders =
|
||||
# Right-biased map union for `HttpHeaders`
|
||||
if override.isNil:
|
||||
return fallback
|
||||
|
||||
result = newHttpHeaders()
|
||||
# Copy by value
|
||||
result.table[] = fallback.table[]
|
||||
|
||||
if override.isNil:
|
||||
# Return the copy of fallback so it does not get modified
|
||||
return result
|
||||
|
||||
for k, vs in override.table:
|
||||
result[k] = vs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user