From dc848b4f8a036bd7ff160a55ff0cbbb40881af50 Mon Sep 17 00:00:00 2001 From: Stephan Kasdorf Date: Fri, 9 Oct 2020 19:40:47 +0200 Subject: [PATCH] Version 0.9.5 beta - added additional additional configuration to the view --- core/c/view.php | 8 +++++++- core/i/view.php | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/c/view.php b/core/c/view.php index ab86750..70412c7 100755 --- a/core/c/view.php +++ b/core/c/view.php @@ -84,12 +84,18 @@ class View implements IView } /** + * @param string $encoding * @desc setting response to application json headers */ - public static function forwardToJsonHeader() + public static function forwardToJsonHeader( string $encoding = "" ) { header(self::NIBIRU_CONTENT_TYPE_JSON, true); header(self::NIBIRU_CONTENT_TYPE_CONNECTION, true); + header(self::NIBIRU_CONTENT_ENCODING, true); + if(strlen($encoding)>0) + { + header(str_replace('{transfer}', $encoding, self::NIBIRU_CONTENT_TRANSFER_ENCODING)); + } } /** diff --git a/core/i/view.php b/core/i/view.php index 9727025..4fc7060 100644 --- a/core/i/view.php +++ b/core/i/view.php @@ -17,7 +17,9 @@ interface IView const NIBIRU_ROUTING = "ROUTING"; const NIBIRU_EMAIL = "EMAIL"; const NIBIRU_FILE_END = ".tpl"; - const NIBIRU_CONTENT_TYPE_JSON = "Content-Type: application/json"; - const NIBIRU_CONTENT_TYPE_CONNECTION = "Connection: keep-alive"; - const NIBIRU_CONTENT_RESPONSE_OK = "HTTP/1.1 200 OK"; + const NIBIRU_CONTENT_TYPE_JSON = "Content-Type: application/json"; + const NIBIRU_CONTENT_TYPE_CONNECTION = "Connection: keep-alive"; + const NIBIRU_CONTENT_RESPONSE_OK = "HTTP/1.1 200 OK"; + const NIBIRU_CONTENT_ENCODING = "Accept-Encoding: gzip, deflate"; + const NIBIRU_CONTENT_TRANSFER_ENCODING = "Transfer-Encoding: {encoding}"; } \ No newline at end of file