summaryrefslogtreecommitdiffstats
path: root/application/core
diff options
context:
space:
mode:
Diffstat (limited to 'application/core')
-rw-r--r--application/core/MY_Controller.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/application/core/MY_Controller.php b/application/core/MY_Controller.php
index 09b813b71..4c0fa278c 100644
--- a/application/core/MY_Controller.php
+++ b/application/core/MY_Controller.php
@@ -32,12 +32,18 @@ class MY_Controller extends CI_Controller {
mb_internal_encoding('UTF-8');
$this->load->helper(array('form', 'filebin'));
+ // TODO: proper accept header handling or is this enough?
if (isset($_SERVER["HTTP_ACCEPT"])) {
if ($_SERVER["HTTP_ACCEPT"] == "application/json") {
request_type("json");
}
}
+ // Allow for easier testing in browser
+ if ($this->input->get("json") !== false) {
+ request_type("json");
+ }
+
if (request_type() == "json" && ! in_array($this->uri->rsegment(2), $this->json_enabled_functions)) {
show_error("Function not JSON enabled");
}