diff --git a/lib/req.ex b/lib/req.ex index 374a9833..555fdcfc 100644 --- a/lib/req.ex +++ b/lib/req.ex @@ -299,6 +299,12 @@ defmodule Req do * `:plug` - if set, calls the given plug instead of making an HTTP request over the network (via [`run_plug`](`Req.Steps.run_plug/1`) step). + The plug can be one of: + + * `fun(conn)` - a function plug. + + * `module` or `{module, options}` - a module plug. + Finch options ([`run_finch`](`Req.Steps.run_finch/1`) step) * `:finch` - the Finch pool to use. Defaults to pool automatically started by `Req`. diff --git a/lib/req/steps.ex b/lib/req/steps.ex index c75b95cd..791cb592 100644 --- a/lib/req/steps.ex +++ b/lib/req/steps.ex @@ -1118,7 +1118,11 @@ defmodule Req.Steps do ## Request Options - * `:plug` - the plug to run the request against. + * `:plug` - the plug to run the request against. The plug can be one of: + + * `fun(conn)` - a 1-arity function that accepts a `Plug.Conn` and returns it. + + * `module` or `{module, options}` - a module plug ## Examples diff --git a/lib/req/test.ex b/lib/req/test.ex index d2e38020..e2d9970e 100644 --- a/lib/req/test.ex +++ b/lib/req/test.ex @@ -297,8 +297,11 @@ defmodule Req.Test do See [module documentation](`Req.Test`) for more examples. While this function can store any `value` under `stub_name`, usually you'll want to store - a *plug*, that is, a function that takes a `Plug.Conn` and returns a `Plug.Conn`, a module plug, - or a `{module, options}` plug. + a *plug*, that is: + + * `fun(conn)` - a function plug. + + * `module` or `{module, options}` - a module plug. ## Examples