private function parseResponse(Response $response, $path)
{
$statusCode = $response->getStatusCode();
if ($statusCode !== 200) {
throw new UnexpectedValueException(sprintf('Expected status code 200 from "%s", got %d', $path, $statusCode));
}
$contentType = $response->hasHeader('content-type') ? $response->getContentType() : '';
if (substr($contentType, 0, 10) !== 'text/plain') {
throw new UnexpectedValueException(sprintf('Expected content type "text/plain" from "%s", got "%s"', $path, $contentType));
}
return $this->parseRequestFromResponse($response, $path);
}