* Fix https://github.com/nim-lang/Nim/issues/13573 and https://github.com/nim-lang/Nim/issues/13574

* Restored asynchttpserver
This commit is contained in:
Andrea Ferretti 2020-03-06 19:38:56 +01:00 • committed by GitHub
commit 7ae0811818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View file

@ -105,11 +105,15 @@ proc newHttpHeaders*(): HttpHeaders =
proc newHttpHeaders*(keyValuePairs:
openArray[tuple[key: string, val: string]]): HttpHeaders =
var pairs: seq[tuple[key: string, val: seq[string]]] = @[]
for pair in keyValuePairs:
pairs.add((pair.key.toLowerAscii(), @[pair.val]))
new result
result.table = newTable[string, seq[string]](pairs)
result.table = newTable[string, seq[string]]()
for pair in keyValuePairs:
let key = pair.key.toLowerAscii()
if key in result.table:
result.table[key].add(pair.val)
else:
result.table[key] = @[pair.val]
proc `$`*(headers: HttpHeaders): string =
return $headers.table