Add RawDisplayHandler and fix RSS/Atom not producing the correct headers

This commit is contained in:
Kijin Sung 2020-12-13 22:06:16 +09:00
parent 35203b684d
commit a405b91e42
5 changed files with 49 additions and 4 deletions

View file

@ -1021,10 +1021,14 @@ class Context
* @param string $method Response method. [HTML|XMLRPC|JSON]
* @return void
*/
public static function setResponseMethod($method = 'HTML')
public static function setResponseMethod($method = 'HTML', $content_type = null)
{
$methods = array('HTML' => 1, 'XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
$methods = array('HTML' => 1, 'XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1, 'RAW' => 1);
self::$_instance->response_method = isset($methods[$method]) ? $method : 'HTML';
if ($content_type)
{
self::$_instance->response_content_type = $content_type;
}
}
/**
@ -1040,7 +1044,7 @@ class Context
}
$method = self::getRequestMethod();
$methods = array('HTML' => 1, 'XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
$methods = array('HTML' => 1, 'XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1, 'RAW' => 1);
return isset($methods[$method]) ? $method : 'HTML';
}