2016-12-23 15:33:21 +01:00
|
|
|
= cowboy_handler:terminate(3)
|
|
|
|
|
|
|
|
== Name
|
|
|
|
|
|
|
|
cowboy_handler:terminate - Terminate the handler
|
|
|
|
|
|
|
|
== Description
|
|
|
|
|
|
|
|
[source,erlang]
|
|
|
|
----
|
2017-09-04 14:33:44 +02:00
|
|
|
terminate(Reason, PartialReq, State, Handler) -> ok
|
2016-12-23 15:33:21 +01:00
|
|
|
|
2017-09-04 14:33:44 +02:00
|
|
|
Reason :: any()
|
|
|
|
PartialReq :: map()
|
|
|
|
State :: any()
|
|
|
|
Handler :: module()
|
2016-12-23 15:33:21 +01:00
|
|
|
----
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2017-09-04 14:33:44 +02:00
|
|
|
PartialReq::
|
2016-12-23 15:33:21 +01:00
|
|
|
|
|
|
|
The Req object.
|
|
|
|
+
|
2017-09-04 14:33:44 +02:00
|
|
|
It is possible to remove fields from the Req object to save memory
|
|
|
|
when the handler has no concept of requests/responses. The only
|
|
|
|
requirement is that a map is provided.
|
2016-12-23 15:33:21 +01:00
|
|
|
|
|
|
|
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)]
|