fix: [https] errors caught by the health element

feature-scoped-element
iglocska 2021-06-14 10:02:16 +02:00
parent e1ac7fe2e6
commit 20027f4d69
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 14 additions and 7 deletions

View File

@ -104,13 +104,20 @@ class MispConnector extends CommonConnectorTools
{
$settings = json_decode($connection->settings, true);
$http = new Client();
$response = $http->post($settings['url'] . '/users/view/me.json', '{}', [
'headers' => [
'AUTHORIZATION' => $settings['authkey'],
'Accept' => 'Application/json',
'Content-type' => 'Application/json'
]
]);
try {
$response = $http->post($settings['url'] . '/users/view/me.json', '{}', [
'headers' => [
'AUTHORIZATION' => $settings['authkey'],
'Accept' => 'Application/json',
'Content-type' => 'Application/json'
]
]);
} catch (\Exception $e) {
return [
'status' => 0,
'message' => __('Connection issue.')
];
}
$responseCode = $response->getStatusCode();
if ($response->isOk()) {
$status = 1;