Esempio n. 1
0
 /**
  * @param ApiPayloadInterface $payload
  * @param null                $path
  * @param null                $verb
  *
  * @return ApiRequest
  */
 protected function _createRequest(ApiPayloadInterface $payload = null, $path = null, $verb = null)
 {
     if ($path === null) {
         $path = $this->_path;
     } else {
         if (substr($path, 0, 1) !== '/') {
             $path = Path::buildUnix($this->_path, $path);
         }
     }
     $path = $this->_buildPath($path, $payload);
     if ($payload === null) {
         $request = ApiRequest::create($verb ? $verb : HttpVerb::GET, $path);
     } else {
         if ($verb === HttpVerb::GET) {
             $request = ApiRequest::create(HttpVerb::GET, $path, [], $payload->toArray());
         } else {
             $request = ApiRequest::create($verb ?: HttpVerb::POST, $path, $payload->toArray());
         }
     }
     $request->setApi($this->getApi());
     return $request;
 }
Esempio n. 2
0
 /**
  * @expectedException \GuzzleHttp\Exception\RequestException
  * @expectedExceptionMessageRegExp /(\[curl\] \(#6\))|(cURL error 6)/
  */
 public function testInvalidDomain()
 {
     $api = new MockApi('http://invalid.this-domain-does-not-exist.co.test');
     $request = ApiRequest::create()->setApi($api);
     $request->get();
 }