private function requestRestbase($method, $path, $params, $reqheaders = array())
 {
     $request = array('method' => $method, 'url' => '/restbase/local/v1/' . $path);
     if ($method === 'GET') {
         $request['query'] = $params;
     } else {
         $request['body'] = $params;
     }
     $request['headers'] = $reqheaders;
     $response = $this->serviceClient->run($request);
     if ($response['code'] === 200 && $response['error'] === "") {
         // If response was served directly from Varnish, use the response
         // (RP) header to declare the cache hit and pass the data to the client.
         $headers = $response['headers'];
         $rp = null;
         if (isset($headers['x-cache']) && strpos($headers['x-cache'], 'hit') !== false) {
             $rp = 'cached-response=true';
         }
         if ($rp !== null) {
             $resp = $this->getRequest()->response();
             $resp->header('X-Cache: ' . $rp);
         }
     } elseif ($response['error'] !== '') {
         $this->dieUsage('docserver-http-error: ' . $response['error'], $response['error']);
     } else {
         // error null, code not 200
         $this->dieUsage('docserver-http: HTTP ' . $response['code'], $response['code']);
     }
     return $response['body'];
 }
 private function requestRestbase($method, $path, $params)
 {
     $request = array('method' => $method, 'url' => '/restbase/local/v1/' . $path);
     if ($method === 'GET') {
         $request['query'] = $params;
     } else {
         $request['body'] = $params;
     }
     $response = $this->serviceClient->run($request);
     if ($response['code'] === 200 && $response['error'] === '') {
         return $response['body'];
     } elseif ($response['error'] !== '') {
         $this->dieUsage('restbase-http-error: ' . $response['code'], $response['error']);
     } else {
         // error null, code not 200
         $this->dieUsage('restbase-http: HTTP ' . $response['code'], $response['code']);
     }
 }