Test ogdClient
testing/ogcore-api/pipeline/head This commit looks good Details

pull/12/head
Manuel Aranda Rosales 2024-10-23 10:35:42 +02:00
parent 4973be6af6
commit 1db829d9ff
1 changed files with 7 additions and 12 deletions

View File

@ -22,18 +22,10 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
#[AsController]
class StatusAction extends AbstractController
{
protected readonly HttpClientInterface $httpClient;
public function __construct(
protected readonly EntityManagerInterface $entityManager,
)
{
$this->httpClient = HttpClient::create([
'verify_peer' => false,
'verify_host' => false,
]);
}
protected readonly HttpClientInterface $httpClient
) {}
/**
* @throws TransportExceptionInterface
@ -48,8 +40,11 @@ class StatusAction extends AbstractController
}
try {
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status');
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status', [
'verify_peer' => false,
'verify_host' => false,
'timeout' => 10,
]);
$statusCode = $response->getStatusCode();
$client->setStatus($statusCode === Response::HTTP_OK ? 'active' : 'off');