aboutsummaryrefslogtreecommitdiffstats
path: root/guide
diff options
context:
space:
mode:
Diffstat (limited to 'guide')
-rw-r--r--guide/http_handlers.md2
-rw-r--r--guide/introduction.md6
-rw-r--r--guide/loop_handlers.md6
3 files changed, 7 insertions, 7 deletions
diff --git a/guide/http_handlers.md b/guide/http_handlers.md
index ea88c79..aba0e06 100644
--- a/guide/http_handlers.md
+++ b/guide/http_handlers.md
@@ -16,7 +16,7 @@ this should be used for any initialization needs.
The second callback, `handle/2`, is where most of your code should
be. As the name explains, this is where you handle the request.
-The last callback, `terminate/2`, will be empty most of the time.
+The last callback, `terminate/3`, will be empty most of the time.
It's used for any needed cleanup. If you used the process dictionary,
timers, monitors then you most likely want to stop them in this
callback, as Cowboy might end up reusing this process for subsequent
diff --git a/guide/introduction.md b/guide/introduction.md
index f1fd18e..c7f48e2 100644
--- a/guide/introduction.md
+++ b/guide/introduction.md
@@ -87,7 +87,7 @@ handlers, Websocket handlers, REST handlers and static handlers. Their
usage is documented in the respective sections of the guide.
Most applications use the plain HTTP handler, which has three callback
-functions: init/3, handle/2 and terminate/2. Following is an example of
+functions: init/3, handle/2 and terminate/3. Following is an example of
a simple handler module.
``` erlang
@@ -96,7 +96,7 @@ a simple handler module.
-export([init/3]).
-export([handle/2]).
--export([terminate/2]).
+-export([terminate/3]).
init({tcp, http}, Req, Opts) ->
{ok, Req, undefined_state}.
@@ -105,7 +105,7 @@ handle(Req, State) ->
{ok, Req2} = cowboy_req:reply(200, [], <<"Hello World!">>, Req),
{ok, Req2, State}.
-terminate(Req, State) ->
+terminate(Reason, Req, State) ->
ok.
```
diff --git a/guide/loop_handlers.md b/guide/loop_handlers.md
index 64cf80a..c3d1891 100644
--- a/guide/loop_handlers.md
+++ b/guide/loop_handlers.md
@@ -31,7 +31,7 @@ practice is known as server-sent events.
Loop handlers essentially wait for one or more Erlang messages
and feed these messages to the `info/3` callback. It also features
-the `init/3` and `terminate/2` callbacks which work the same as
+the `init/3` and `terminate/3` callbacks which work the same as
for plain HTTP handlers.
The following handler waits for a message `{reply, Body}` before
@@ -46,7 +46,7 @@ this message.
-export([init/3]).
-export([info/3]).
--export([terminate/2]).
+-export([terminate/3]).
init({tcp, http}, Req, Opts) ->
{loop, Req, undefined_state, 60000, hibernate}.
@@ -57,6 +57,6 @@ info({reply, Body}, Req, State) ->
info(Message, Req, State) ->
{loop, Req, State, hibernate}.
-terminate(Req, State) ->
+terminate(Reason, Req, State) ->
ok.
```