mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
parent
218e67527b
commit
a1b7cd216b
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Core;
|
namespace Icinga\Module\Director\Core;
|
||||||
|
|
||||||
use Icinga\Application\Benchmark;
|
use Icinga\Application\Benchmark;
|
||||||
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class RestApiClient
|
class RestApiClient
|
||||||
@ -172,6 +173,14 @@ class RestApiClient
|
|||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
throw new Exception('CURL ERROR: ' . curl_error($curl));
|
throw new Exception('CURL ERROR: ' . curl_error($curl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||||
|
if ($statusCode === 401) {
|
||||||
|
throw new ConfigurationError(
|
||||||
|
'Unable to authenticate, please check your API credentials'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Benchmark::measure('Rest Api, got response');
|
Benchmark::measure('Rest Api, got response');
|
||||||
|
|
||||||
if ($stream) {
|
if ($stream) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user