Split getting a closure of the route method into a separate function to allow it to be overloaded.