/**
  * @param Response $response
  *
  * @return string|array|\Neoxygen\NeoClient\Formatter\Response
  *
  * @throws Neo4jException
  */
 public function handleHttpResponse(Response $response)
 {
     if ($this->newFormatModeEnabled) {
         $newResponse = $this->newFormattingService->formatResponse($response->getRaw());
         if ($newResponse->hasError()) {
             $error = $newResponse->getError();
             throw new Neo4jException(sprintf($error->getCode(), $error->getMessage(), Neo4jException::fromCode($error->getCode())));
         }
         return $newResponse;
     }
     $this->checkResponseErrors($response->getBody());
     if ($this->autoFormatResponse) {
         $formatted = $this->formatResponse($response->getBody());
         $response->setResult($formatted->getResult());
         $response->setRows($formatted->geRows());
     }
     return $response;
 }
 /**
  * @param array       $labels
  * @param string|null $conn
  *
  * @return Response
  * @deprecetad Will be removed in 4.0
  */
 public function listIndexes(array $labels = array(), $conn = null)
 {
     if (empty($labels)) {
         $labels = $this->getLabels($conn)->getBody();
     }
     $indexes = [];
     foreach ($labels as $label) {
         $res = $this->listIndex($label, $conn);
         $indexs = $res->getBody();
         $indexes[$label] = $indexs;
     }
     if (!isset($res)) {
         if ($this->newFormatModeEnabled) {
             $res = new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200));
         } else {
             $res = new Response(new PsrResponse(200));
         }
     }
     if ($res instanceof \GraphAware\NeoClient\Formatter\Response) {
         return new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200, [], json_encode($indexes)));
     }
     $response = new Response($res->getRaw());
     $response->setBody($indexes);
     return $response;
 }