aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-06-03 08:11:07 +0200
committerLoïc Hoguin <[email protected]>2018-06-03 08:11:07 +0200
commita644ecfd0fb67870ac3f3a13476aa0accec74d28 (patch)
tree90b9343dd9438630a2b31b6d5c8c7df040ad03be
parent6233bdbb712b857680c6ccfab6b2692c1e15514e (diff)
downloadgun-a644ecfd0fb67870ac3f3a13476aa0accec74d28.tar.gz
gun-a644ecfd0fb67870ac3f3a13476aa0accec74d28.tar.bz2
gun-a644ecfd0fb67870ac3f3a13476aa0accec74d28.zip
Fill in the options types instead of using map()
-rw-r--r--doc/src/manual/gun.asciidoc2
-rw-r--r--src/gun.erl31
2 files changed, 27 insertions, 6 deletions
diff --git a/doc/src/manual/gun.asciidoc b/doc/src/manual/gun.asciidoc
index 77253ba..45f65ab 100644
--- a/doc/src/manual/gun.asciidoc
+++ b/doc/src/manual/gun.asciidoc
@@ -150,7 +150,7 @@ opts() :: #{
retry_timeout => pos_integer(),
trace => boolean(),
transport => tcp | ssl,
- transport_opts => [gen_tcp:connect_option()] | [ssl:connect_option()]
+ transport_opts => [gen_tcp:connect_option()] | [ssl:connect_option()],
ws_opts => ws_opts()
}
----
diff --git a/src/gun.erl b/src/gun.erl
index bad1418..badd691 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -91,21 +91,42 @@
| {text | binary | close | ping | pong, iodata()}
| {close, ws_close_code(), iodata()}.
--type opts() :: map().
+-type opts() :: #{
+ connect_timeout => timeout(),
+ http_opts => http_opts(),
+ http2_opts => http2_opts(),
+ protocols => [http | http2],
+ retry => non_neg_integer(),
+ retry_timeout => pos_integer(),
+ trace => boolean(),
+ transport => tcp | ssl,
+ transport_opts => [gen_tcp:connect_option()] | [ssl:connect_option()],
+ ws_opts => ws_opts()
+}.
-export_type([opts/0]).
%% @todo Add an option to disable/enable the notowner behavior.
--type req_opts() :: map().
+-type req_opts() :: #{
+ reply_to => pid()
+}.
-export_type([req_opts/0]).
--type http_opts() :: map().
+-type http_opts() :: #{
+ keepalive => timeout(),
+ transform_header_name => fun((binary()) -> binary()),
+ version => 'HTTP/1.1' | 'HTTP/1.0'
+}.
-export_type([http_opts/0]).
--type http2_opts() :: map().
+-type http2_opts() :: #{
+ keepalive => timeout()
+}.
-export_type([http2_opts/0]).
%% @todo keepalive
--type ws_opts() :: map().
+-type ws_opts() :: #{
+ compress => boolean()
+}.
-export_type([ws_opts/0]).
-record(state, {