aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_protocol.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-03-21 17:51:21 +0100
committerLoïc Hoguin <[email protected]>2011-03-21 17:51:21 +0100
commite3dc9b269441dfc7499e7b172fc28b14d682d2b7 (patch)
tree1bd8571c10c88cc4985f0ee93d5ba68222b164c6 /src/cowboy_http_protocol.erl
parent8b02992e6abd63eab0aafe0d762c38dbbbb757b5 (diff)
downloadcowboy-e3dc9b269441dfc7499e7b172fc28b14d682d2b7.tar.gz
cowboy-e3dc9b269441dfc7499e7b172fc28b14d682d2b7.tar.bz2
cowboy-e3dc9b269441dfc7499e7b172fc28b14d682d2b7.zip
Add specs to ensure_response and change the clauses order.
Diffstat (limited to 'src/cowboy_http_protocol.erl')
-rw-r--r--src/cowboy_http_protocol.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index b02f471..a6cedbe 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -182,13 +182,14 @@ skip_body(Length, Req) ->
_Any -> ok
end.
+-spec ensure_response(Req::#http_req{}, State::#state{}) -> ok.
+%% The handler has already fully replied to the client.
+ensure_response(#http_req{resp_state=done}, _State) ->
+ ok;
%% No response has been sent but everything apparently went fine.
%% Reply with 204 No Content to indicate this.
ensure_response(#http_req{resp_state=waiting}, State) ->
- error_response(204, State);
-%% The handler has already fully replied to the client.
-ensure_response(#http_req{resp_state=done}, _State) ->
- ok.
+ error_response(204, State).
-spec error_response(Code::http_status(), State::#state{}) -> ok.
error_response(Code, #state{socket=Socket,