aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-10-04 13:21:16 +0300
committerLoïc Hoguin <[email protected]>2014-10-04 13:21:16 +0300
commit21d9ebe33b3eaf65a4118fc5c3e7364e64d63769 (patch)
tree5a679864c47cd50f55ad06831a36a92a03d3ad59 /doc
parent4bc8e330fa239d1ade18a5d75ea018f1a954bfb3 (diff)
downloadcowboy-21d9ebe33b3eaf65a4118fc5c3e7364e64d63769.tar.gz
cowboy-21d9ebe33b3eaf65a4118fc5c3e7364e64d63769.tar.bz2
cowboy-21d9ebe33b3eaf65a4118fc5c3e7364e64d63769.zip
Reverse the order of arguments of match_* functions
Wasn't following the same order as the rest of the module.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/guide/cookies.ezdoc6
-rw-r--r--doc/src/guide/req.ezdoc6
-rw-r--r--doc/src/manual/cowboy_req.ezdoc4
3 files changed, 8 insertions, 8 deletions
diff --git a/doc/src/guide/cookies.ezdoc b/doc/src/guide/cookies.ezdoc
index 459d4d8..e6d1aeb 100644
--- a/doc/src/guide/cookies.ezdoc
+++ b/doc/src/guide/cookies.ezdoc
@@ -132,7 +132,7 @@ Cookies = cowboy_req:parse_cookies(Req),
You can match the cookies into a map.
``` erlang
-#{id := ID, lang := Lang} = cowboy_req:match_cookies(Req, [id, lang]).
+#{id := ID, lang := Lang} = cowboy_req:match_cookies([id, lang], Req).
```
You can use constraints to validate the values while matching
@@ -142,7 +142,7 @@ the `id` cookie value will be converted to an integer term, saving
you a conversion step.
``` erlang
-CookiesMap = cowboy_req:match_cookies(Req, [{id, int}, {lang, nonempty}]).
+CookiesMap = cowboy_req:match_cookies([{id, int}, {lang, nonempty}], Req).
```
Note that if two cookies share the same name, then the map value
@@ -155,7 +155,7 @@ if the `lang` cookie is not found. It will not be used if
the cookie is found but has an empty value.
``` erlang
-#{lang := Lang} = cowboy_req:match_cookies(Req, [{lang, [], <<"en-US">>}]).
+#{lang := Lang} = cowboy_req:match_cookies([{lang, [], <<"en-US">>}], Req).
```
If no default is provided and the value is missing, the
diff --git a/doc/src/guide/req.ezdoc b/doc/src/guide/req.ezdoc
index bc60227..add6166 100644
--- a/doc/src/guide/req.ezdoc
+++ b/doc/src/guide/req.ezdoc
@@ -142,7 +142,7 @@ QsVals = cowboy_req:parse_qs(Req),
You can match the query string into a map.
``` erlang
-#{id := ID, lang := Lang} = cowboy_req:match_qs(Req, [id, lang]).
+#{id := ID, lang := Lang} = cowboy_req:match_qs([id, lang], Req).
```
You can use constraints to validate the values while matching
@@ -152,7 +152,7 @@ the `id` value will be converted to an integer term, saving
you a conversion step.
``` erlang
-QsMap = cowboy_req:match_qs(Req, [{id, int}, {lang, nonempty}]).
+QsMap = cowboy_req:match_qs([{id, int}, {lang, nonempty}], Req).
```
Note that in the case of duplicate query string keys, the map
@@ -165,7 +165,7 @@ if the `lang` key is not found. It will not be used if
the key is found but has an empty value.
``` erlang
-#{lang := Lang} = cowboy_req:match_qs(Req, [{lang, [], <<"en-US">>}]).
+#{lang := Lang} = cowboy_req:match_qs([{lang, [], <<"en-US">>}], Req).
```
If no default is provided and the value is missing, the
diff --git a/doc/src/manual/cowboy_req.ezdoc b/doc/src/manual/cowboy_req.ezdoc
index 9a2f34f..9b73886 100644
--- a/doc/src/manual/cowboy_req.ezdoc
+++ b/doc/src/manual/cowboy_req.ezdoc
@@ -128,7 +128,7 @@ Return the requested URL excluding the path component.
This function will always return `undefined` until the
`cowboy_router` middleware has been executed.
-: match_cookies(Req, Fields) -> Map
+: match_cookies(Fields, Req) -> Map
Types:
@@ -153,7 +153,7 @@ be converted through the use of constraints, making this
function able to extract, validate and convert values all
in one step.
-: match_qs(Req, Fields) -> Map
+: match_qs(Fields, Req) -> Map
Types: