From cabfc7ec5cee16f9fca401716e429d3631dbe85c Mon Sep 17 00:00:00 2001 From: treeform Date: Tue, 1 Dec 2020 14:29:15 -0800 Subject: 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. --- lib/pure/httpclient.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/pure/httpclient.nim') 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: -- cgit 1.4.1-2-gfad0