/** * Reads response meta tags to guess content-type charset. */ protected function createResponse(GuzzleResponse $response) { $body = $response->getBody(true); $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]; } } $response->setHeader('Content-Type', $contentType); return parent::createResponse($response); }