本文整理汇总了PHP中Guzzle\Http\Client::getDefaultOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getDefaultOption方法的具体用法?PHP Client::getDefaultOption怎么用?PHP Client::getDefaultOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\Client
的用法示例。
在下文中一共展示了Client::getDefaultOption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeGuzzle
/**
* Lazy loads the access token by running authentication and setting the access token into the $this->guzzle headers
*/
protected function initializeGuzzle()
{
if ($this->guzzle->getDefaultOption('headers/Authorization')) {
return;
}
$this->setAccessTokenInGuzzleFromAuthentication();
}
示例2: testHasDefaultOptionsHelperMethods
public function testHasDefaultOptionsHelperMethods()
{
$client = new Client();
// With path
$client->setDefaultOption('headers/foo', 'bar');
$this->assertEquals('bar', $client->getDefaultOption('headers/foo'));
// With simple key
$client->setDefaultOption('allow_redirects', false);
$this->assertFalse($client->getDefaultOption('allow_redirects'));
$this->assertEquals(array('headers' => array('foo' => 'bar'), 'allow_redirects' => false), $client->getConfig('request.options'));
$request = $client->get('/');
$this->assertEquals('bar', $request->getHeader('foo'));
}
示例3: testHasDefaultOptionsHelperMethods
public function testHasDefaultOptionsHelperMethods()
{
$client = new Client();
// With path
$client->setDefaultOption('headers/foo', 'bar');
$this->assertEquals('bar', $client->getDefaultOption('headers/foo'));
// With simple key
$client->setDefaultOption('allow_redirects', false);
$this->assertFalse($client->getDefaultOption('allow_redirects'));
}
示例4: testCorrectHeaderWhenAccessTokenGiven
public function testCorrectHeaderWhenAccessTokenGiven()
{
$provider = new DropboxLoader($this->client, 'DROPBOX FOLDER');
$provider->enableOauthAuthentication('DROPBOX KEY', 'DROPBOX SECRET', 'DROPBOX ACCESS TOKEN');
$this->assertEquals('Bearer DROPBOX ACCESS TOKEN', $this->client->getDefaultOption('request.options/headers/Authorization'));
}