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