mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Change the type of bindings from a list to a map
Maps make more sense because the keys are unique.
This commit is contained in:
parent
91ae70b06c
commit
9255cdf1d7
6 changed files with 25 additions and 33 deletions
|
@ -197,8 +197,6 @@ And any other combination.
|
|||
|
||||
=== Bindings
|
||||
|
||||
// @todo Bindings should probably be a map themselves.
|
||||
|
||||
Bindings are the host and path components that you chose
|
||||
to extract when defining the routes of your application.
|
||||
They are only available after the routing.
|
||||
|
@ -222,10 +220,7 @@ To retrieve everything that was bound:
|
|||
[source,erlang]
|
||||
Bindings = cowboy_req:bindings(Req).
|
||||
|
||||
They are returned as a list of key/value pairs, with
|
||||
keys being atoms.
|
||||
|
||||
// ...
|
||||
They are returned as a map, with keys being atoms.
|
||||
|
||||
The Cowboy router also allows you to capture many host
|
||||
or path segments at once using the `...` qualifier.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue