cowboy_handler:terminate(3)

NAME

cowboy_handler:terminate - Terminate the handler

DESCRIPTION
    terminate(Reason, PartialReq, State, Handler) -> ok

    Reason     :: any()
    PartialReq :: map()
    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.

PartialReq
    The Req object.

    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.

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
    cowboy_handler:terminate(normal, Req, State, Handler).

SEE ALSO

cowboy_handler(3)