diff options
author | Loïc Hoguin <[email protected]> | 2012-07-24 01:07:31 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-07-24 01:07:31 +0200 |
commit | 76d6ed83ceb8dfd4b70336c24757b55cfad758f0 (patch) | |
tree | cef022b3bb8308e6343364df9b8e7c03df07ab63 /src | |
parent | f3c5881dd41ce121151079c8315c7b39c003ee73 (diff) | |
download | cowboy-76d6ed83ceb8dfd4b70336c24757b55cfad758f0.tar.gz cowboy-76d6ed83ceb8dfd4b70336c24757b55cfad758f0.tar.bz2 cowboy-76d6ed83ceb8dfd4b70336c24757b55cfad758f0.zip |
Improve typespecs
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_http_req.erl | 6 | ||||
-rw-r--r-- | src/cowboy_http_rest.erl | 6 |
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. |