Skip to content

Commit f521e5f

Browse files
committed
rename headers to authorization
1 parent 9d82be9 commit f521e5f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/TwitterOAuth.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ public function oauth2($path, array $parameters = array())
157157
$this->response->setApiPath($path);
158158
$url = sprintf('%s/%s', self::API_HOST, $path);
159159
$request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
160-
$headers = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
161-
$result = $this->request($request->getNormalizedHttpUrl(), $method, $headers, $parameters);
160+
$authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
161+
$result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
162162
$response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
163163
$this->response->setBody($response);
164164
return $response;
@@ -244,34 +244,35 @@ private function oAuthRequest($url, $method, array $parameters)
244244
}
245245
if ($this->bearer === null) {
246246
$request->signRequest($this->signatureMethod, $this->consumer, $this->token);
247-
$headers = $request->toHeader();
247+
$authorization = $request->toHeader();
248248
} else {
249-
$headers = 'Authorization: Bearer ' . $this->bearer;
249+
$authorization = 'Authorization: Bearer ' . $this->bearer;
250250
}
251-
return $this->request($request->getNormalizedHttpUrl(), $method, $headers, $parameters);
251+
return $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
252252
}
253253

254254
/**
255255
* Make an HTTP request
256256
*
257257
* @param string $url
258258
* @param string $method
259-
* @param string $headers
259+
* @param string $authorization
260260
* @param array $postfields
261261
*
262262
* @return string
263263
* @throws TwitterOAuthException
264264
*/
265-
private function request($url, $method, $headers, $postfields)
265+
private function request($url, $method, $authorization, $postfields)
266266
{
267+
var_dump('$authorization', $authorization);
267268
/* Curl settings */
268269
$options = array(
269270
// CURLOPT_VERBOSE => true,
270271
CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
271272
CURLOPT_CAPATH => __DIR__,
272273
CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
273274
CURLOPT_HEADER => true,
274-
CURLOPT_HTTPHEADER => array($headers, 'Expect:'),
275+
CURLOPT_HTTPHEADER => array($authorization, 'Expect:'),
275276
CURLOPT_RETURNTRANSFER => true,
276277
CURLOPT_SSL_VERIFYHOST => 2,
277278
CURLOPT_SSL_VERIFYPEER => true,

0 commit comments

Comments
 (0)