code: private function hasCookie(Response $response): bool
      {
          /** @var Cookie[] $cookies */
          $cookies = $response->headers->getCookies();
  
          foreach ($cookies as $cookie) {
              if (self::COOKIE_NAME === $cookie->getName()) {
                  return true;
              }
          }
  
          return false;
      }
docs: Returns whether the response has a cookie with that name.