/** * @param BaseRequest $request * @return Response * @throws \cdcchen\net\curl\RequestException */ public function execute(BaseRequest $request) { $request->beforeExecute(); $this->_params = array_merge($this->_params, $request->getParams()); $this->prepare(); $response = CUrlClient::post($this->_restUrl, $this->_params)->send(); return $this->afterExecute($request, $response); }
/** * @return string * @throws \cdcchen\upyun\base\RequestException * @throws \cdcchen\upyun\base\ResponseException */ public function getBucketUsage() { $path = '/?usage'; $url = $this->buildRequestUrl($path); $headers = $this->buildHeaders('GET', $path); $request = Client::get($url, null, $headers); $response = static::sendRequest($request); return static::handleResponse($response, function (HttpResponse $response) { return $response->getContent(); }); }
/** * @param BaseRequest $request * @return bool|Response * @throws \cdcchen\net\curl\RequestException */ public function execute(BaseRequest $request) { if (!$this->beforeExecute($request)) { return false; } $request->beforeExecute(); $this->mergeRequestParams($request); $this->prepare(); $httpRequest = CUrlClient::post($this->getRestUrl(), $this->_params); if ($this->_https) { $httpRequest->setSSL(); } /* @var HttpResponse $response */ $response = $httpRequest->send(); $this->applyFilters($response); return $this->afterExecute($response); }