Extract req/resp modification in middleware.