aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-01-06 17:01:41 +0100
committerLoïc Hoguin <[email protected]>2019-01-06 17:01:41 +0100
commitab4878838fafbd453b41d031c9224b2ee8d2d956 (patch)
tree432a9fa69523af7637c3eeab0435b625c70a2cbd /doc
parenteee5a59bc1763fc2e1c8c6e7155939dd04d930b7 (diff)
downloadgun-ab4878838fafbd453b41d031c9224b2ee8d2d956.tar.gz
gun-ab4878838fafbd453b41d031c9224b2ee8d2d956.tar.bz2
gun-ab4878838fafbd453b41d031c9224b2ee8d2d956.zip
Lowercase header names automatically and accept more types
Header names can now be provided as binary, string or atom and Gun no longer requires them to be in lowercase. The list of headers can also be provided as a map as well.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/guide/introduction.asciidoc5
-rw-r--r--doc/src/manual/gun.asciidoc14
-rw-r--r--doc/src/manual/gun.connect.asciidoc2
-rw-r--r--doc/src/manual/gun.delete.asciidoc2
-rw-r--r--doc/src/manual/gun.get.asciidoc2
-rw-r--r--doc/src/manual/gun.head.asciidoc2
-rw-r--r--doc/src/manual/gun.headers.asciidoc2
-rw-r--r--doc/src/manual/gun.options.asciidoc2
-rw-r--r--doc/src/manual/gun.patch.asciidoc2
-rw-r--r--doc/src/manual/gun.post.asciidoc2
-rw-r--r--doc/src/manual/gun.put.asciidoc2
-rw-r--r--doc/src/manual/gun.request.asciidoc2
-rw-r--r--doc/src/manual/gun.ws_upgrade.asciidoc2
13 files changed, 26 insertions, 15 deletions
diff --git a/doc/src/guide/introduction.asciidoc b/doc/src/guide/introduction.asciidoc
index 374f1f3..fa0e6c6 100644
--- a/doc/src/guide/introduction.asciidoc
+++ b/doc/src/guide/introduction.asciidoc
@@ -46,7 +46,4 @@ In the HTTP protocol, the method name is case sensitive. All standard
method names are uppercase.
Header names are case insensitive. Gun converts all the header names
-to lowercase, and expects your application to provide lowercase header
-names.
-
-The same applies to any other case insensitive value.
+to lowercase, including request headers provided by your application.
diff --git a/doc/src/manual/gun.asciidoc b/doc/src/manual/gun.asciidoc
index dff927c..2726564 100644
--- a/doc/src/manual/gun.asciidoc
+++ b/doc/src/manual/gun.asciidoc
@@ -267,6 +267,16 @@ ws_opts (#{})::
Options specific to the Websocket protocol.
+=== req_headers()
+
+[source,erlang]
+----
+req_headers() :: [{binary() | string() | atom(), iodata()}]
+ | #{binary() | string() | atom() => iodata()}
+----
+
+Request headers.
+
=== req_opts()
[source,erlang]
@@ -315,6 +325,10 @@ undocumented and must be set to `gun_ws_h`.
== Changelog
+* *2.0*: Introduce the type `req_headers()` and extend the
+ types accepted for header names for greater
+ interoperability. Header names are automatically
+ lowercased as well.
* *2.0*: Function `gun:headers/4,5` introduced.
* *2.0*: The `keepalive` option is now set to `infinity` by
default for the HTTP/1.1 protocol, disabling it.
diff --git a/doc/src/manual/gun.connect.asciidoc b/doc/src/manual/gun.connect.asciidoc
index 483b24d..de40e34 100644
--- a/doc/src/manual/gun.connect.asciidoc
+++ b/doc/src/manual/gun.connect.asciidoc
@@ -19,7 +19,7 @@ connect(ConnPid, Destination, Headers, ReqOpts)
ConnPid :: pid()
Destination :: gun:connect_destination()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
----
diff --git a/doc/src/manual/gun.delete.asciidoc b/doc/src/manual/gun.delete.asciidoc
index feb64ff..7367adb 100644
--- a/doc/src/manual/gun.delete.asciidoc
+++ b/doc/src/manual/gun.delete.asciidoc
@@ -19,7 +19,7 @@ delete(ConnPid, Path, Headers, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
----
diff --git a/doc/src/manual/gun.get.asciidoc b/doc/src/manual/gun.get.asciidoc
index 623c038..64feeab 100644
--- a/doc/src/manual/gun.get.asciidoc
+++ b/doc/src/manual/gun.get.asciidoc
@@ -19,7 +19,7 @@ get(ConnPid, Path, Headers, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
----
diff --git a/doc/src/manual/gun.head.asciidoc b/doc/src/manual/gun.head.asciidoc
index 3d92e38..08ce86b 100644
--- a/doc/src/manual/gun.head.asciidoc
+++ b/doc/src/manual/gun.head.asciidoc
@@ -19,7 +19,7 @@ head(ConnPid, Path, Headers, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
----
diff --git a/doc/src/manual/gun.headers.asciidoc b/doc/src/manual/gun.headers.asciidoc
index bab1b82..4abcb39 100644
--- a/doc/src/manual/gun.headers.asciidoc
+++ b/doc/src/manual/gun.headers.asciidoc
@@ -17,7 +17,7 @@ headers(ConnPid, Method, Path, Headers, ReqOpts)
ConnPid :: pid()
Method :: binary()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
----
diff --git a/doc/src/manual/gun.options.asciidoc b/doc/src/manual/gun.options.asciidoc
index 5b36f22..dfbba7b 100644
--- a/doc/src/manual/gun.options.asciidoc
+++ b/doc/src/manual/gun.options.asciidoc
@@ -19,7 +19,7 @@ options(ConnPid, Path, Headers, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
----
diff --git a/doc/src/manual/gun.patch.asciidoc b/doc/src/manual/gun.patch.asciidoc
index c240a4d..cdc8f97 100644
--- a/doc/src/manual/gun.patch.asciidoc
+++ b/doc/src/manual/gun.patch.asciidoc
@@ -22,7 +22,7 @@ patch(ConnPid, Path, Headers, Body, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
Body :: iodata()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
diff --git a/doc/src/manual/gun.post.asciidoc b/doc/src/manual/gun.post.asciidoc
index aed8b3f..a545a32 100644
--- a/doc/src/manual/gun.post.asciidoc
+++ b/doc/src/manual/gun.post.asciidoc
@@ -22,7 +22,7 @@ post(ConnPid, Path, Headers, Body, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
Body :: iodata()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
diff --git a/doc/src/manual/gun.put.asciidoc b/doc/src/manual/gun.put.asciidoc
index a60849b..7807d68 100644
--- a/doc/src/manual/gun.put.asciidoc
+++ b/doc/src/manual/gun.put.asciidoc
@@ -22,7 +22,7 @@ put(ConnPid, Path, Headers, Body, ReqOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
Body :: iodata()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
diff --git a/doc/src/manual/gun.request.asciidoc b/doc/src/manual/gun.request.asciidoc
index f5c1cd8..0a50499 100644
--- a/doc/src/manual/gun.request.asciidoc
+++ b/doc/src/manual/gun.request.asciidoc
@@ -17,7 +17,7 @@ request(ConnPid, Method, Path, Headers, Body, ReqOpts)
ConnPid :: pid()
Method :: binary()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
Body :: iodata()
ReqOpts :: gun:req_opts()
StreamRef :: reference()
diff --git a/doc/src/manual/gun.ws_upgrade.asciidoc b/doc/src/manual/gun.ws_upgrade.asciidoc
index cb9da06..241d916 100644
--- a/doc/src/manual/gun.ws_upgrade.asciidoc
+++ b/doc/src/manual/gun.ws_upgrade.asciidoc
@@ -19,7 +19,7 @@ ws_upgrade(ConnPid, Path, Headers, WsOpts)
ConnPid :: pid()
Path :: iodata()
-Headers :: [{binary(), iodata()}]
+Headers :: gun:req_headers()
WsOpts :: gun:ws_opts
StreamRef :: reference()
----