diff --git a/app/Check/Consumers/HttpStatusCodeCheck.php b/app/Check/Consumers/HttpStatusCodeCheck.php index fef6595..5e9f473 100644 --- a/app/Check/Consumers/HttpStatusCodeCheck.php +++ b/app/Check/Consumers/HttpStatusCodeCheck.php @@ -14,24 +14,17 @@ class HttpStatusCodeCheck extends Check protected function doHardJob(\Pd\Monitoring\Check\Check $check): bool { try { - $config = [ - 'verify' => FALSE, - 'allow_redirects' => FALSE, - ]; - - $options = [ - 'connect_timeout' => self::TIMEOUT, - 'timeout' => 2 * self::TIMEOUT, - 'headers' => [ - 'User-Agent' => 'PeckaMonitoringBot/1.0', - ], - ]; - - $client = new \GuzzleHttp\Client($config); + + $client = \Pd\Monitoring\Check\Consumers\Client\ClientBuilder::create(2 * self::TIMEOUT, self::TIMEOUT) + ->withVerify(FALSE) + ->withAllowRedirects(\Pd\Monitoring\Check\Consumers\Client\Conf\AllowRedirects::create(FALSE)) + ->build() + ; + try { $this->logInfo($check, \sprintf('Kontrola ID "%s". Začínám stahovat url "%s".', $check->id, $check->url)); - $response = $client->get($check->url, $options); + $response = $client->get($check->url); $this->logHeaders($check, $response);