/**
  * @param Response $response
  * @param string $clazz
  * @return mixed
  * @throws ClassCastException
  */
 protected function computeResponse($response, $clazz)
 {
     if (false === ($response->isContentType(Constants::CONTENT_TYPE_JSON) || $response->isContentType(Constants::CONTENT_TYPE_JSON_NXENTITY))) {
         if (Blob::className !== $clazz) {
             throw new ClassCastException(sprintf('Cannot cast %s as %s', Blob::className, $clazz));
         }
         return Blob::fromHttpResponse($response);
     }
     $body = $response->getBody(true);
     return $this->nuxeoClient->getConverter()->read($body, $clazz);
 }