Update middleware to return response.