diff --git a/lib/plug/builder.ex b/lib/plug/builder.ex index 7bcf40d3..84f9eb08 100644 --- a/lib/plug/builder.ex +++ b/lib/plug/builder.ex @@ -123,6 +123,23 @@ defmodule Plug.Builder do halt(conn) end end + + ## Debugging a pipeline + + During development, you may wish to display the current state of the connection + at a certain point in the pipeline. This can be achieved by plugging the `dbg/2` + macro from Elixir. Since it accepts and returns the connection as first argument, + and takes options as the second, it just works: + + defmodule PlugWithDbg do + use Plug.Builder + + plug Plug.RewriteOn + plug :dbg + plug Plug.MethodOverride + plug :dbg, charlists: :as_lists + end + """ @type plug :: module | atom