From 234f954c015d2ab8e6d5a0703de7dee71b892e0e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 21 Mar 2024 10:14:33 +0100 Subject: [PATCH] Controller: Serve JSON if accepted fixes #988 --- library/Icingadb/Web/Controller.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Icingadb/Web/Controller.php b/library/Icingadb/Web/Controller.php index 91b28a044..aa083a70a 100644 --- a/library/Icingadb/Web/Controller.php +++ b/library/Icingadb/Web/Controller.php @@ -513,7 +513,12 @@ public function preDispatch() { parent::preDispatch(); - $this->format = $this->params->shift('format'); + $this->format = $this->params->shift( + 'format', + $this->getRequest()->isApiRequest() + ? 'json' + : null + ); } public function postDispatch()