diff options
author | treeform <starplant@gmail.com> | 2020-12-01 14:29:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 23:29:15 +0100 |
commit | cabfc7ec5cee16f9fca401716e429d3631dbe85c (patch) | |
tree | a8ae67a8d00d978b6c5274888e7ee17b0285234c /lib/pure/httpclient.nim | |
parent | ae9fe2b2f996abbab1f7f7d037a955a7cffa9b6a (diff) | |
download | Nim-cabfc7ec5cee16f9fca401716e429d3631dbe85c.tar.gz |
Don't add content-length header on GET request when there is no body. (#16196)
* Don't add content-length header on GET request when there is no body. * Add space between the not and the (. * Take Dom's suggestion.
Diffstat (limited to 'lib/pure/httpclient.nim')
-rw-r--r-- | lib/pure/httpclient.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index 0cf19f031..880c05765 100644 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -980,7 +980,7 @@ proc requestAux(client: HttpClient | AsyncHttpClient, url, httpMethod: string, var data: seq[string] if multipart != nil and multipart.content.len > 0: data = await client.format(multipart) - else: + elif httpMethod in ["POST", "PATCH", "PUT"] or body.len != 0: client.headers["Content-Length"] = $body.len when client is AsyncHttpClient: |