blob: f10d945e0b420653e929fb833a80623596bae698 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
= cowboy_handler:terminate(3)
== Name
cowboy_handler:terminate - Terminate the handler
== Description
[source,erlang]
----
terminate(Reason, Req | undefined, State, Handler) -> ok
Reason :: any()
Req :: cowboy_req:req()
State :: any()
Handler :: module()
----
Call the optional terminate callback if it is defined.
Make sure to use this function at the end of the execution
of modules that implement custom handler behaviors.
== Arguments
Reason::
Reason for termination.
Req::
The Req object.
+
It is possible to pass `undefined` if the handler has no concept
of requests/responses and discarded the Req object before calling
this function.
State::
Handler state.
Handler::
Handler module.
== Return value
The atom `ok` is always returned. It can be safely ignored.
== Changelog
* *2.0*: Function introduced.
== Examples
.Terminate a handler normally
[source,erlang]
----
cowboy_handler:terminate(normal, Req, State, Handler).
----
== See also
link:man:cowboy_handler(3)[cowboy_handler(3)]
|