refreshVariables(); $request_options[RequestOptions::HTTP_ERRORS] = FALSE; $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); } /** * Adds the Xdebug cookie to the request options. * * @param array $request_options * The request options. * * @return array * Request options updated with the Xdebug cookie if present. */ protected function decorateWithXdebugCookie(array $request_options): array { $session = $this->getSession(); $driver = $session->getDriver(); if ($driver instanceof BrowserKitDriver) { $client = $driver->getClient(); foreach ($client->getCookieJar()->all() as $cookie) { if (isset($request_options[RequestOptions::HEADERS]['Cookie'])) { $request_options[RequestOptions::HEADERS]['Cookie'] .= '; ' . $cookie->getName() . '=' . $cookie->getValue(); } else { $request_options[RequestOptions::HEADERS]['Cookie'] = $cookie->getName() . '=' . $cookie->getValue(); } } } return $request_options; } }