aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cowboy_http_req.erl6
-rw-r--r--src/cowboy_http_rest.erl6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index 6f5fdfa..2789bb4 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -222,7 +222,8 @@ headers(Req) ->
%% returned is used as a return value.
%% @see parse_header/3
-spec parse_header(cowboy_http:header(), #http_req{})
- -> {any(), #http_req{}} | {error, badarg}.
+ -> {any(), #http_req{}} | {undefined, binary(), #http_req{}}
+ | {error, badarg}.
parse_header(Name, Req=#http_req{p_headers=PHeaders}) ->
case lists:keyfind(Name, 1, PHeaders) of
false -> parse_header(Name, Req, parse_header_default(Name));
@@ -239,7 +240,8 @@ parse_header_default(_Name) -> undefined.
%%
%% When the header is unknown, the value is returned directly without parsing.
-spec parse_header(cowboy_http:header(), #http_req{}, any())
- -> {any(), #http_req{}} | {error, badarg}.
+ -> {any(), #http_req{}} | {undefined, binary(), #http_req{}}
+ | {error, badarg}.
parse_header(Name, Req, Default) when Name =:= 'Accept' ->
parse_header(Name, Req, Default,
fun (Value) ->
diff --git a/src/cowboy_http_rest.erl b/src/cowboy_http_rest.erl
index b37f20e..f58d0ee 100644
--- a/src/cowboy_http_rest.erl
+++ b/src/cowboy_http_rest.erl
@@ -28,16 +28,16 @@
%% Media type.
content_types_p = [] ::
- [{{binary(), binary(), [{binary(), binary()}]}, atom()}],
+ [{binary() | {binary(), binary(), [{binary(), binary()}]}, atom()}],
content_type_a :: undefined
- | {{binary(), binary(), [{binary(), binary()}]}, atom()},
+ | {binary() | {binary(), binary(), [{binary(), binary()}]}, atom()},
%% Language.
languages_p = [] :: [binary()],
language_a :: undefined | binary(),
%% Charset.
- charsets_p = [] :: [binary()],
+ charsets_p = [] :: [{binary(), atom()}],
charset_a :: undefined | binary(),
%% Cached resource calls.