terminate(Reason, Req | undefined, State, Handler) -> ok Reason :: any() Req :: cowboy_req:req() State :: any() Handler :: module()
cowboy_handler:terminate - Terminate the handler
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.
Reason for termination.
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.
Handler state.
Handler module.
The atom ok
is always returned. It can be safely ignored.
2.0: Function introduced.
cowboy_handler:terminate(normal, Req, State, Handler).