add a callback for setting data in middleware from request