aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-08-10 17:15:02 +0200
committerLoïc Hoguin <[email protected]>2016-08-10 17:15:02 +0200
commite30d120bd8c9a4a7b469937d5b5be6a8dfe148d4 (patch)
tree5eb48865b2ad61d3c05bdc0e3e1f639a6b966ffe /src/cowboy_http.erl
parentaa6f2ab5a48d90e47648dfb53e0894dcaa6f6aac (diff)
downloadcowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.tar.gz
cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.tar.bz2
cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.zip
Make reply functions return Req
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index 279b11a..773f891 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -805,6 +805,11 @@ commands(State, StreamID, [{flow, _Length}|Tail]) ->
%% @todo Set the body reading length to min(Length, BodyLength)
commands(State, StreamID, Tail);
+%% Error responses are sent only if a response wasn't sent already.
+commands(State=#state{out_state=wait}, StreamID, [{error_response, StatusCode, Headers, Body}|Tail]) ->
+ commands(State, StreamID, [{response, StatusCode, Headers, Body}|Tail]);
+commands(State, StreamID, [{error_response, _, _, _}|Tail]) ->
+ commands(State, StreamID, Tail);
%% Send a full response.
%%
%% @todo Kill the stream if it sent a response when one has already been sent.