RestApi: add a new helper method to this trait
This commit is contained in:
parent
9f7568c0ea
commit
e2d753bad7
|
@ -35,6 +35,21 @@ trait RestApi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function sendNotFoundUnlessRestApi()
|
||||||
|
{
|
||||||
|
/** @var \Icinga\Web\Request $request */
|
||||||
|
$request = $this->getRequest();
|
||||||
|
if ($request->isApiRequest()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$this->sendJsonError($this->getResponse(), 'Not found', 404);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws AuthenticationException
|
* @throws AuthenticationException
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue