0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Remove the meta functions from cowboy_req

Now that we have a public map they are pretty much pointless.
This commit is contained in:
Loïc Hoguin 2016-06-21 22:43:29 +02:00
parent 19468d0503
commit bcff1262d0

View file

@ -40,9 +40,6 @@
-export([parse_header/3]).
-export([parse_cookies/1]).
-export([match_cookies/2]).
-export([meta/2]).
-export([meta/3]).
-export([set_meta/3]).
%% Request body API.
-export([has_body/1]).
@ -414,21 +411,6 @@ parse_cookies(Req) ->
match_cookies(Fields, Req) ->
filter(Fields, kvlist_to_map(Fields, parse_cookies(Req))).
-spec meta(atom(), req()) -> any() | undefined.
meta(Name, Req) ->
meta(Name, Req, undefined).
-spec meta(atom(), req(), any()) -> any().
meta(Name, Req, Default) ->
case lists:keyfind(Name, 1, Req#http_req.meta) of
{Name, Value} -> Value;
false -> Default
end.
-spec set_meta(atom(), any(), Req) -> Req when Req::req().
set_meta(Name, Value, Req=#http_req{meta=Meta}) ->
Req#http_req{meta=lists:keystore(Name, 1, Meta, {Name, Value})}.
%% Request Body API.
-spec has_body(req()) -> boolean().