Minor formatting changes in API_V1_Controller.php

This commit is contained in:
Alex Tselegidis 2020-09-03 14:59:05 +03:00
parent f05a4be918
commit 395b329e78

View file

@ -75,7 +75,9 @@ class API_V1_Controller extends CI_Controller {
protected function _getBearerToken()
{
$headers = $this->_getAuthorizationHeader();
// HEADER: Get the access token from the header
if ( ! empty($headers))
{
if (preg_match('/Bearer\s(\S+)/', $headers, $matches))
@ -109,15 +111,18 @@ class API_V1_Controller extends CI_Controller {
elseif (function_exists('apache_request_headers'))
{
$requestHeaders = apache_request_headers();
// Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
// Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care
// about capitalization for Authorization).
$requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders));
//print_r($requestHeaders);
if (isset($requestHeaders['Authorization']))
{
$headers = trim($requestHeaders['Authorization']);
}
}
}
return $headers;
}