Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #23 from eugenegp/master
Browse files Browse the repository at this point in the history
for fixing bug #21
  • Loading branch information
everzet committed Jul 3, 2013
2 parents 7779ccd + 79da366 commit fa1b073
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Behat/Mink/Driver/Goutte/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ class Client extends BaseClient
protected function createResponse(GuzzleResponse $response)
{
$body = $response->getBody(true);
$statusCode = $response->getStatusCode();
$headers = $response->getHeaders()->getAll();
$contentType = $response->getContentType();

if (!$contentType || false === strpos($contentType, 'charset=')) {
if (preg_match('/\<meta[^\>]+charset *= *["\']?([a-zA-Z\-0-9]+)/i', $body, $matches)) {
$contentType .= ';charset='.$matches[1];
}
}
$headers['Content-Type'] = $contentType;
$response->setHeader('Content-Type', $contentType);

return new Response($body, $statusCode, $headers);
return parent::createResponse($response);
}
}

0 comments on commit fa1b073

Please sign in to comment.