From 8cabb88dbb408ceb2e51deb50811488e38abb098 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 8 Oct 2020 13:25:46 +0900 Subject: [PATCH] Be more consistent about JSON responses cf. #152 --- classes/display/DisplayHandler.class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 501fc4e57..5831ffb14 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -100,7 +100,7 @@ class DisplayHandler extends Handler // header output $httpStatusCode = $oModule->getHttpStatusCode(); - if($httpStatusCode !== 200 && !in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON', 'JS_CALLBACK'))) + if($httpStatusCode !== 200 && !in_array(Context::getResponseMethod(), array('XMLRPC', 'JSON', 'JS_CALLBACK'))) { self::_printHttpStatusCode($httpStatusCode); } @@ -108,10 +108,7 @@ class DisplayHandler extends Handler { if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK' || isset($_POST['_rx_ajax_compat'])) { - if(strpos($_SERVER['HTTP_ACCEPT'], 'json') !== false) - { - self::_printJSONHeader(); - } + self::_printJSONHeader(); } elseif(Context::getResponseMethod() == 'XMLRPC') {