Plug
Plug behaviour
The plug specification.
There are two kind of plugs: function plugs and module plugs.
Function plugs
A function plug is any function that receives a connection and a set of options and returns a connection. Its type signature must be:
(Plug.Conn.t, Plug.opts) :: Plug.Conn.t
Module plugs
A module plug is an extension of the function plug. It is a module that must export:
- a
call/2
function with the signature defined above - an
init/1
function which takes a set of options and initializes it.
The result returned by init/1
is passed as second argument to call/2
. Note that init/1
may be called during compilation and as such it must not return pids, ports or v