diff --git a/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
index 8283bef260..85c802a7b3 100644
--- a/core/modules/rest/tests/src/Functional/ResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/ResourceTestBase.php
@@ -349,7 +349,12 @@ protected function request($method, Url $url, array $request_options) {
     $request_options[RequestOptions::ALLOW_REDIRECTS] = FALSE;
     $request_options = $this->decorateWithXdebugCookie($request_options);
     $client = $this->getSession()->getDriver()->getClient()->getClient();
-    return $client->request($method, $url->setAbsolute(TRUE)->toString(), $request_options);
+    // 'Less magic' version ;)
+    $lock = fopen('/tmp/request-lock.txt', 'r+');
+    flock($lock, LOCK_EX);
+    $response = $client->request($method, $url->setAbsolute(TRUE)->toString(), $request_options);
+    fclose($lock);
+    return $response;
   }
 
   /**
