aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-03-21 11:04:09 +0100
committerLoïc Hoguin <[email protected]>2014-03-21 11:04:09 +0100
commit24eb6f3f9e93a72063c57923fcb88cb5cb5e8c82 (patch)
tree9519aea80976408a1218abd4e46cca64b96a79c3
parent8c0e428b012c59f553a264f285ed89d36f791e3e (diff)
downloadcowlib-24eb6f3f9e93a72063c57923fcb88cb5cb5e8c82.tar.gz
cowlib-24eb6f3f9e93a72063c57923fcb88cb5cb5e8c82.tar.bz2
cowlib-24eb6f3f9e93a72063c57923fcb88cb5cb5e8c82.zip
Improve specs in cow_http
-rw-r--r--src/cow_http.erl12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/cow_http.erl b/src/cow_http.erl
index ac8f556..d10ff4f 100644
--- a/src/cow_http.erl
+++ b/src/cow_http.erl
@@ -24,7 +24,7 @@
-type version() :: 'HTTP/1.0' | 'HTTP/1.1'.
-type status() :: 100..999.
--type headers() :: [{binary(), binary()}].
+-type headers() :: [{binary(), iodata()}].
-include("cow_inline.hrl").
@@ -106,7 +106,7 @@ horse_parse_status_line_other() ->
%% @doc Parse the list of headers.
--spec parse_headers(binary()) -> {headers(), binary()}.
+-spec parse_headers(binary()) -> {[{binary(), binary()}], binary()}.
parse_headers(Data) ->
parse_header(Data, []).
@@ -262,11 +262,9 @@ parse_fullpath_test() ->
%% @doc Convert an HTTP version to atom.
--spec parse_version(binary()) -> 'HTTP/1.1' | 'HTTP/1.0'.
-parse_version(<<"HTTP/1.1">>) ->
- 'HTTP/1.1';
-parse_version(<<"HTTP/1.0">>) ->
- 'HTTP/1.0'.
+-spec parse_version(binary()) -> version().
+parse_version(<<"HTTP/1.1">>) -> 'HTTP/1.1';
+parse_version(<<"HTTP/1.0">>) -> 'HTTP/1.0'.
-ifdef(TEST).
parse_version_test() ->