0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 12:40:25 +00:00

change init/2 to return #state{} in documentation

Most examples returned 'Opts' as given by second argument to init. By
using '#state{}' the examples make it more clear that this is what is
being passed as 'State' to all subsequent callbacks (if any).
This commit is contained in:
Stefan Strigler 2014-10-08 16:49:18 +02:00
parent b87150c713
commit 8fd3ff2d62
5 changed files with 23 additions and 23 deletions

View file

@ -13,8 +13,8 @@ to all handlers. To use REST for the current request, this function
must return a `cowboy_rest` tuple.
``` erlang
init(Req, Opts) ->
{cowboy_rest, Req, Opts}.
init(Req, _Opts) ->
{cowboy_rest, Req, #state{}}.
```
Cowboy will then switch to the REST protocol and start executing