コード例 #1
0
 public function testCreateWithAdapterOptions()
 {
     $capath = '/some/path';
     $maxRedirs = 4;
     $client = $this->_factory->createHttpClient(array('options' => array(HttpClientFactory::OPT_CAPATH => $capath), 'curl_adapter_options' => array(CURLOPT_MAXREDIRS => $maxRedirs)));
     $adapterConfig = $client->getAdapter()->getConfig();
     $this->assertSame($maxRedirs, $adapterConfig['curloptions'][CURLOPT_MAXREDIRS]);
 }
コード例 #2
0
 /**
  * Creates and returns the HTTP client based on the provided configuration.
  * 
  * @param array $config
  * @return Http\Client
  */
 protected function _createHttpClient(array $config)
 {
     $httpClientFactory = new HttpClientFactory();
     $client = $httpClientFactory->createHttpClient($config);
     return $client;
 }