Replace deprecated env method with request.env