mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-22 00:41:28 +00:00
Silence hint:performance message when using very basic http client (#23832)
code such as:
```Nim
import std/httpclient # nim c --hint:performance:on
echo newHttpClient(proxy=nil,
headers=newHttpHeaders({"Accept": "*/*"})).getContent("x")
```
(Fix was suggested by @ringabout in a private channel.)
Seems useful since `httpclient` is so basic/probably pervasive with many
hundreds of `import`s across the NimbleVerse.
This commit is contained in:
@@ -164,7 +164,8 @@ func `[]`*(headers: HttpHeaders, key: string): HttpHeaderValues =
|
||||
## To access multiple values of a key, use the overloaded `[]` below or
|
||||
## to get all of them access the `table` field directly.
|
||||
{.cast(noSideEffect).}:
|
||||
return headers.table[headers.toCaseInsensitive(key)].HttpHeaderValues
|
||||
let tmp = headers.table[headers.toCaseInsensitive(key)]
|
||||
return HttpHeaderValues(tmp)
|
||||
|
||||
converter toString*(values: HttpHeaderValues): string =
|
||||
return seq[string](values)[0]
|
||||
|
||||
Reference in New Issue
Block a user