Пример #1
0
 /**
  * Helper method to execute deferred HTTP requests.
  *
  * @param $request Postman_Google_Http_Request|Postman_Google_Http_Batch
  * @throws Postman_Google_Exception
  * @return object of the type of the expected class or array.
  */
 public function execute($request)
 {
     if ($request instanceof Postman_Google_Http_Request) {
         $request->setUserAgent($this->getApplicationName() . " " . self::USER_AGENT_SUFFIX . $this->getLibraryVersion());
         if (!$this->getClassConfig("Postman_Google_Http_Request", "disable_gzip")) {
             $request->enableGzip();
         }
         $request->maybeMoveParametersToBody();
         return Postman_Google_Http_REST::execute($this, $request);
     } else {
         if ($request instanceof Postman_Google_Http_Batch) {
             return $request->execute();
         } else {
             throw new Postman_Google_Exception("Do not know how to execute this type of object.");
         }
     }
 }