File 0003-gun_http-don-t-add-zero-content-length-to-headers-fo.patch of Package gun

From db22eddce5b994a4612e91a150ec373cad3f83cf Mon Sep 17 00:00:00 2001
From: Led <ledest@gmail.com>
Date: Thu, 20 Jan 2022 21:45:12 +0200
Subject: [PATCH 3/6] gun_http: don't add zero content-length to headers for
 DELETE/GET/HEAD/OPTIONS methods

---
 src/gun_http.erl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gun_http.erl b/src/gun_http.erl
index 5165ca6..4554438 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -628,6 +628,9 @@ send_request(State=#http_state{socket=Socket, transport=Transport, version=Versi
 			lists:keystore(<<"transfer-encoding">>, 1, Headers1,
 				{<<"transfer-encoding">>, <<"chunked">>});
 		{undefined, _} -> Headers1;
+		{<<>>, _} when Method =:= <<"DELETE">>; Method =:= <<"GET">>;
+				Method =:= <<"HEAD">>; Method =:= <<"OPTIONS">> ->
+			 Headers1;
 		_ ->
 			lists:keystore(<<"content-length">>, 1, Headers1,
 				{<<"content-length">>, integer_to_binary(iolist_size(Body))})
-- 
2.43.0

openSUSE Build Service is sponsored by