protected function Client::filterResponse in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/http-kernel/Client.php \Symfony\Component\HttpKernel\Client::filterResponse()
- 8.0 vendor/symfony/browser-kit/Client.php \Symfony\Component\BrowserKit\Client::filterResponse()
- 8.0 vendor/behat/mink-goutte-driver/src/Goutte/Client.php \Behat\Mink\Driver\Goutte\Client::filterResponse()
Same name and namespace in other branches
- 8 vendor/behat/mink-goutte-driver/src/Goutte/Client.php \Behat\Mink\Driver\Goutte\Client::filterResponse()
Reads response meta tags to guess content-type charset.
Parameters
Response $response:
Return value
Overrides Client::filterResponse
File
- vendor/
behat/ mink-goutte-driver/ src/ Goutte/ Client.php, line 28
Class
- Client
- Client overrides to support Mink functionality.
Namespace
Behat\Mink\Driver\GoutteCode
protected function filterResponse($response) {
$contentType = $response
->getHeader('Content-Type');
if (!$contentType || false === strpos($contentType, 'charset=')) {
if (preg_match('/\\<meta[^\\>]+charset *= *["\']?([a-zA-Z\\-0-9]+)/i', $response
->getContent(), $matches)) {
$headers = $response
->getHeaders();
$headers['Content-Type'] = $contentType . ';charset=' . $matches[1];
$response = new Response($response
->getContent(), $response
->getStatus(), $headers);
}
}
return parent::filterResponse($response);
}