/** * 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(); }
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')); }
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')); }
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')); }