The problem is that Slim PHP 3 $request->getHeaders() function is not returning Authorization header parameter while the default getallheaders() PHP function is working correctly. When I use this Slim PHP function in a normal route, it's returning Authorization header parameter correctly, the issue exists only in the middleware.
Request headers:
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:hu-HU,hu;q=0.8,en-US;q=0.6,en;q=0.4,it;q=0.2
Authorization:Bearer *****
Connection:keep-alive
Cookie:*****
Host:*****
Referer:*****
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Code snippet:
public function __invoke($request, $response, $next) {
$slimHeaders = $request->getHeaders();
var_dump($slimHeaders);
$phpHeaders = getallheaders();
var_dump($phpHeaders);
}
The problem is that Slim PHP 3
$request->getHeaders()
function is not returning Authorization header parameter while the defaultgetallheaders()
PHP function is working correctly. When I use this Slim PHP function in a normal route, it's returning Authorization header parameter correctly, the issue exists only in the middleware.Request headers:
Code snippet:
$slimHeaders dump:
$phpHeaders dump: