Browse Source

Fix Dialyzer warnings

Loïc Hoguin 8 years ago
parent
commit
52a2ff96e8
3 changed files with 6 additions and 5 deletions
  1. 4 4
      src/cow_hpack.erl
  2. 1 0
      src/cow_http.erl
  3. 1 1
      src/cow_http_hd.erl

+ 4 - 4
src/cow_hpack.erl

@@ -32,7 +32,7 @@
 -record(state, {
 	size = 0 :: non_neg_integer(),
 	max_size = 4096 :: non_neg_integer(),
-	dyn_table = [] :: queue:queue({binary(), binary()})
+	dyn_table = [] :: [{pos_integer(), {binary(), binary()}}]
 }).
 
 -opaque state() :: #state{}.
@@ -548,15 +548,15 @@ resp_decode_test() ->
 
 %% Encoding.
 
--spec encode(cow_http:headers()) -> iodata().
+-spec encode(cow_http:headers()) -> {iodata(), state()}.
 encode(Headers) ->
 	encode(Headers, init(), #{}, []).
 
--spec encode(cow_http:headers(), State) -> iodata() when State::state().
+-spec encode(cow_http:headers(), State) -> {iodata(), State} when State::state().
 encode(Headers, State) ->
 	encode(Headers, State, #{}, []).
 
--spec encode(cow_http:headers(), State, opts()) -> iodata() when State::state().
+-spec encode(cow_http:headers(), State, opts()) -> {iodata(), State} when State::state().
 encode(Headers, State, Opts) ->
 	encode(Headers, State, Opts, []).
 

+ 1 - 0
src/cow_http.erl

@@ -28,6 +28,7 @@
 -type version() :: 'HTTP/1.0' | 'HTTP/1.1'.
 -type status() :: 100..999.
 -type headers() :: [{binary(), iodata()}].
+-export_type([headers/0]).
 
 -include("cow_inline.hrl").
 

+ 1 - 1
src/cow_http_hd.erl

@@ -1970,7 +1970,7 @@ horse_parse_host_ipv6_v4() ->
 
 %% @doc Parse the HTTP2-Settings header.
 
--spec parse_http2_settings(binary()) -> binary().
+-spec parse_http2_settings(binary()) -> map().
 parse_http2_settings(HTTP2Settings) ->
 	cow_http2:parse_settings_payload(base64:decode(HTTP2Settings)).