From 8fd3ff2d629fa13a52061e7db5c67a3ba6fe4429 Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Wed, 8 Oct 2014 16:49:18 +0200 Subject: 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). --- doc/src/guide/rest_handlers.ezdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/src/guide/rest_handlers.ezdoc') diff --git a/doc/src/guide/rest_handlers.ezdoc b/doc/src/guide/rest_handlers.ezdoc index 1868f0a..71a471f 100644 --- a/doc/src/guide/rest_handlers.ezdoc +++ b/doc/src/guide/rest_handlers.ezdoc @@ -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 -- cgit v1.2.3