diff --git a/src/Plugin/RulesAction/BanIP.php b/src/Plugin/RulesAction/BanIP.php
index bf54cc4..7a63b25 100644
--- a/src/Plugin/RulesAction/BanIP.php
+++ b/src/Plugin/RulesAction/BanIP.php
@@ -56,7 +56,7 @@ class BanIP extends RulesActionBase implements ContainerFactoryPluginInterface {
       $plugin_id,
       $plugin_definition,
       $container->get('ban.ip_manager'),
-      $container->get('request')
+      $container->get('request_stack')->getCurrentRequest()
     );
   }
 
diff --git a/tests/src/Unit/Integration/Action/BanIPTest.php b/tests/src/Unit/Integration/Action/BanIPTest.php
index 4a7dd68..ad4297a 100644
--- a/tests/src/Unit/Integration/Action/BanIPTest.php
+++ b/tests/src/Unit/Integration/Action/BanIPTest.php
@@ -4,7 +4,7 @@ namespace Drupal\Tests\rules\Unit\Integration\Action;
 
 use Drupal\ban\BanIpManagerInterface;
 use Drupal\Tests\rules\Unit\Integration\RulesIntegrationTestBase;
-use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
  * @coversDefaultClass \Drupal\rules\Plugin\RulesAction\BanIP
@@ -25,9 +25,9 @@ class BanIPTest extends RulesIntegrationTestBase {
   protected $banManager;
 
   /**
-   * @var \Symfony\Component\HttpFoundation\Request|\Prophecy\Prophecy\ProphecyInterface
+   * @var \Symfony\Component\HttpFoundation\RequestStack|\Prophecy\Prophecy\ProphecyInterface
    */
-  protected $request;
+  protected $requestStack;
 
   /**
    * {@inheritdoc}
@@ -39,8 +39,8 @@ class BanIPTest extends RulesIntegrationTestBase {
     $this->banManager = $this->prophesize(BanIpManagerInterface::class);
     $this->container->set('ban.ip_manager', $this->banManager->reveal());
 
-    $this->request = $this->prophesize(Request::class);
-    $this->container->set('request', $this->request->reveal());
+    $this->requestStack = $this->prophesize(RequestStack::class);
+    $this->container->set('request_stack', $this->requestStack->reveal());
 
     $this->action = $this->actionManager->createInstance('rules_ban_ip');
   }
@@ -111,12 +111,11 @@ class BanIPTest extends RulesIntegrationTestBase {
     // TEST-NET-1 IPv4.
     $ip = '192.0.2.0';
 
-    $this->request->getClientIp()->willReturn($ip)->shouldBeCalledTimes(1);
+    $this->requestStack->getCurrentRequest()->getClientIp()->willReturn($ip)->shouldBeCalledTimes(1);
 
     $this->banManager->banIp($ip)->shouldBeCalledTimes(1);
 
     $this->action->execute();
-
   }
 
 }
