mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Add specs to ensure_response and change the clauses order.
This commit is contained in:
parent
8b02992e6a
commit
e3dc9b2694
1 changed files with 5 additions and 4 deletions
|
@ -182,13 +182,14 @@ skip_body(Length, Req) ->
|
||||||
_Any -> ok
|
_Any -> ok
|
||||||
end.
|
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.
|
%% No response has been sent but everything apparently went fine.
|
||||||
%% Reply with 204 No Content to indicate this.
|
%% Reply with 204 No Content to indicate this.
|
||||||
ensure_response(#http_req{resp_state=waiting}, State) ->
|
ensure_response(#http_req{resp_state=waiting}, State) ->
|
||||||
error_response(204, State);
|
error_response(204, State).
|
||||||
%% The handler has already fully replied to the client.
|
|
||||||
ensure_response(#http_req{resp_state=done}, _State) ->
|
|
||||||
ok.
|
|
||||||
|
|
||||||
-spec error_response(Code::http_status(), State::#state{}) -> ok.
|
-spec error_response(Code::http_status(), State::#state{}) -> ok.
|
||||||
error_response(Code, #state{socket=Socket,
|
error_response(Code, #state{socket=Socket,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue