diff --git a/src/EduFramework/Core/Controller/Request.php b/src/EduFramework/Core/Controller/Request.php index 43ac675..b43bd65 100644 --- a/src/EduFramework/Core/Controller/Request.php +++ b/src/EduFramework/Core/Controller/Request.php @@ -55,6 +55,28 @@ public function __construct(string $route, string $httpMethod) $this->route = $route; } + /** + * Permet de récupérer les headers de la requête HTTP + * @return bool|array + */ + public function getHearder(): bool|array + { + if (!function_exists('getallheaders')) { + $headers = []; + foreach ($_SERVER as $name => $value) { + if (substr($name, 0, 5) === 'HTTP_') { + $headers[str_replace( + ' ', + '-', + ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))) + )] = $value; + } + } + return $headers; + } + return getallheaders(); + } + /** * Permet de récupérer une variable de la requête HTTP * @param string $key Le nom de la variable