Skip to content

Commit fbc3778

Browse files
committed
Controller: Serve JSON if accepted
fixes #988
1 parent 02fb857 commit fbc3778

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

library/Icingadb/Web/Controller.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,12 @@ public function preDispatch()
513513
{
514514
parent::preDispatch();
515515

516-
$this->format = $this->params->shift('format');
516+
$this->format = $this->params->shift(
517+
'format',
518+
$this->getRequest()->isApiRequest()
519+
? 'json'
520+
: null
521+
);
517522
}
518523

519524
public function postDispatch()

0 commit comments

Comments
 (0)