0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Add a function to lock request responses instead of inlining

Just more cleanup in order to have req() opaque.
This commit is contained in:
Loïc Hoguin 2012-09-16 13:57:27 +02:00
parent 8d5f8db90a
commit f205d44518
3 changed files with 9 additions and 2 deletions

View file

@ -103,6 +103,7 @@
%% Misc API.
-export([compact/1]).
-export([lock/1]).
-export([to_list/1]).
-export([transport/1]).
@ -908,6 +909,12 @@ compact(Req) ->
bindings=undefined, headers=[],
p_headers=[], cookies=[]}.
%% @doc Prevent any further responses.
%% @private
-spec lock(Req) -> Req when Req::req().
lock(Req) ->
Req#http_req{resp_state=locked}.
%% @doc Convert the Req object to a list of key/values.
-spec to_list(req()) -> [{atom(), any()}].
to_list(Req) ->