diff --git a/Router.php b/Router.php index e3d86b1..8eef534 100644 --- a/Router.php +++ b/Router.php @@ -128,7 +128,7 @@ public static function handle($class, $method, $vars, $routeParams) } catch (\Throwable $e) { - throw new \Exception($e->getMessage()); + self::displayError('Signature verification failed', 400); } } @@ -246,7 +246,8 @@ public static function fetch_from_array(&$array, $index=null, $default = null) private static function getAuthorizationHeader() { // convert all headers to lowercase: $headers = array(); - foreach($_SERVER as $key => $value) { + $header_variables = array_merge($_SERVER, getallheaders()); + foreach($header_variables as $key => $value) { $headers[strtolower($key)] = $value; } @@ -310,4 +311,4 @@ public static function displayError ($message, $status = 500) { // set_error_handler("ProcessWire\Router::handleError"); // set_exception_handler('ProcessWire\Router::handleException'); -// register_shutdown_function('ProcessWire\Router::handleFatalError'); \ No newline at end of file +// register_shutdown_function('ProcessWire\Router::handleFatalError');