Allow non-generators to function as middleware.