Exemple #1
0
 public function testGetHttpClientResetsAuthorizationHeader()
 {
     $client = new HTTPClient19485876();
     $client->setHeaders('Authorization', 'realm="http://www.example.com",oauth_version="1.0"');
     OAuth\OAuth::setHttpClient($client);
     $resetClient = OAuth\OAuth::getHttpClient();
     $this->assertEquals(null, $resetClient->getHeader('Authorization'));
 }
Exemple #2
0
 /**
  * Generate and return a HTTP Client configured for the POST Body Request
  * Scheme specified by OAuth, for use in requesting an Access Token.
  *
  * @param  array $params
  * @return Zend\Http\Client
  */
 public function getRequestSchemePostBodyClient(array $params)
 {
     $params = $this->_cleanParamsOfIllegalCustomParameters($params);
     $client = OAuth\OAuth::getHttpClient();
     $client->setUri($this->_consumer->getAccessTokenUrl());
     $client->setMethod($this->_preferredRequestMethod);
     $client->setRawBody($this->_httpUtility->toEncodedQueryString($params));
     $client->setHeaders(array('ContentType' => Http\Client::ENC_URLENCODED));
     return $client;
 }
Exemple #3
0
 /**
  * Generate and return a HTTP Client configured for the POST Body Request
  * Scheme specified by OAuth, for use in requesting a Request Token.
  *
  * @param  array $params
  * @return Http\Client
  */
 public function getRequestSchemePostBodyClient(array $params)
 {
     $client = OAuth\OAuth::getHttpClient();
     $client->setUri($this->_consumer->getRequestTokenUrl());
     $client->setMethod($this->_preferredRequestMethod);
     $request = $client->getRequest();
     $request->setContent($this->_httpUtility->toEncodedQueryString($params));
     $request->headers()->addHeaderLine('Content-Type', Http\Client::ENC_URLENCODED);
     return $client;
 }
Exemple #4
0
 /**
  * Generate and return a HTTP Client configured for the POST Body Request
  * Scheme specified by OAuth, for use in requesting a Request Token.
  *
  * @param  array $params
  * @return Zend\Http\Client
  */
 public function getRequestSchemePostBodyClient(array $params)
 {
     $client = OAuth\OAuth::getHttpClient();
     $client->setUri($this->_consumer->getRequestTokenUrl());
     $client->setMethod($this->_preferredRequestMethod);
     $client->setRawData(
         $this->_httpUtility->toEncodedQueryString($params)
     );
     $client->setHeaders(
         Http\Client::CONTENT_TYPE,
         Http\Client::ENC_URLENCODED
     );
     return $client;
 }