diff options
author | Loïc Hoguin <[email protected]> | 2013-01-28 23:39:21 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-01-28 23:39:21 +0100 |
commit | c2c333de8add734c5046c7cf2bf97e9bf8799617 (patch) | |
tree | 0b315561d70c9f64c2ae8789826a6392281a6819 /guide | |
parent | a5a69353f1e5de41337d31943f70030261ee45dc (diff) | |
download | cowboy-c2c333de8add734c5046c7cf2bf97e9bf8799617.tar.gz cowboy-c2c333de8add734c5046c7cf2bf97e9bf8799617.tar.bz2 cowboy-c2c333de8add734c5046c7cf2bf97e9bf8799617.zip |
Add the 'function' constraint
Diffstat (limited to 'guide')
-rw-r--r-- | guide/routing.md | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/guide/routing.md b/guide/routing.md index 659b27d..9d5c5af 100644 --- a/guide/routing.md +++ b/guide/routing.md @@ -207,7 +207,7 @@ name, and the optional third element is the constraint's arguments. The following constraints are currently defined: * {Name, int} - * {Name, function, (fun(Value) -> true | {true, NewValue} | false)} + * {Name, function, fun ((Value) -> true | {true, NewValue} | false)} The `int` constraint will check if the binding is a binary string representing an integer, and if it is, will convert the value to integer. @@ -215,6 +215,7 @@ representing an integer, and if it is, will convert the value to integer. The `function` constraint will pass the binding value to a user specified function that receives the binary value as its only argument and must return whether it fulfills the constraint, optionally modifying the value. +The value thus returned can be of any type. Note that constraint functions SHOULD be pure and MUST NOT crash. |