0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Add the private get_resp_state/1 function used by cowboy_protocol

This commit is contained in:
Loïc Hoguin 2012-09-17 00:48:11 +02:00
parent c1dd5b5176
commit e55ec7d43d
2 changed files with 7 additions and 1 deletions

View file

@ -233,7 +233,7 @@ onrequest(Req, State=#state{onrequest=undefined}) ->
dispatch(Req, State); dispatch(Req, State);
onrequest(Req, State=#state{onrequest=OnRequest}) -> onrequest(Req, State=#state{onrequest=OnRequest}) ->
Req2 = OnRequest(Req), Req2 = OnRequest(Req),
case Req2#http_req.resp_state of case cowboy_req:get_resp_state(Req2) of
waiting -> dispatch(Req2, State); waiting -> dispatch(Req2, State);
_ -> next_request(Req2, State, ok) _ -> next_request(Req2, State, ok)
end. end.

View file

@ -108,6 +108,7 @@
-export([add_header/3]). -export([add_header/3]).
-export([set_buffer/2]). -export([set_buffer/2]).
-export([set_bindings/4]). -export([set_bindings/4]).
-export([get_resp_state/1]).
%% Misc API. %% Misc API.
-export([compact/1]). -export([compact/1]).
@ -949,6 +950,11 @@ set_bindings(HostInfo, PathInfo, Bindings, Req) ->
Req#http_req{host_info=HostInfo, path_info=PathInfo, Req#http_req{host_info=HostInfo, path_info=PathInfo,
bindings=Bindings}. bindings=Bindings}.
%% @private
-spec get_resp_state(req()) -> locked | waiting | chunks | done.
get_resp_state(#http_req{resp_state=RespState}) ->
RespState.
%% Misc API. %% Misc API.
%% @doc Compact the request data by removing all non-system information. %% @doc Compact the request data by removing all non-system information.