Version 0.9.5 beta - added additional additional configuration to the view

This commit is contained in:
Stephan Kasdorf
2020-10-09 19:40:47 +02:00
parent 312ca6a776
commit dc848b4f8a
2 changed files with 12 additions and 4 deletions

View File

@@ -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));
}
}
/**

View File

@@ -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}";
}