diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 19e3738ca..a2a1a8c2d 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -780,7 +780,10 @@ protected function init() public function afterHandleRequest() { - if ($this->response->isError() && !$this->request->isAjax()) { + if ($this->response->isError() + && !$this->request->isAjax() + && $this->response->getHeader('Content-Type') !== 'application/json' + ) { $this->init(); $errorCode = $this->response->getStatusCode(); $errorType = $this->response->getStatusDescription(); diff --git a/tests/behat/features/notfound.feature b/tests/behat/features/notfound.feature index 5c2ba314c..6993ffd98 100644 --- a/tests/behat/features/notfound.feature +++ b/tests/behat/features/notfound.feature @@ -1,4 +1,3 @@ -@gsat Feature: Not found As a site owner I want error messages to be displayed in the context of the admin section