aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gun_http.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl
index 1090e6b..c075af2 100644
--- a/src/gun_http.erl
+++ b/src/gun_http.erl
@@ -220,7 +220,11 @@ request(State=#http_state{socket=Socket, transport=Transport, version=Version,
%% We use Headers2 because this is the smallest list.
Conn = conn_from_headers(Version, Headers2),
Out = request_io_from_headers(Headers2),
- Transport:send(Socket, cow_http:request(Method, Path, Version, Headers3)),
+ Headers4 = case Out of
+ body_chunked -> [{<<"transfer-encoding">>, <<"chunked">>}|Headers3];
+ _ -> Headers3
+ end,
+ Transport:send(Socket, cow_http:request(Method, Path, Version, Headers4)),
new_stream(State#http_state{connection=Conn, out=Out}, StreamRef).
request(State=#http_state{socket=Socket, transport=Transport, version=Version,