pass req to decide function

This addition checks the arity of the callback to pass the req
object only when needed.