Skip to content

Commit

Permalink
Controller: Serve JSON if accepted
Browse files Browse the repository at this point in the history
fixes #988
  • Loading branch information
nilmerg committed Mar 22, 2024
1 parent 02fb857 commit fbc3778
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/Icingadb/Web/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fbc3778

Please sign in to comment.