Test ogdClient
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
f13731a047
commit
4973be6af6
|
@ -22,11 +22,25 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
|||
#[AsController]
|
||||
class StatusAction extends AbstractController
|
||||
{
|
||||
protected readonly HttpClientInterface $httpClient;
|
||||
|
||||
|
||||
public function __construct(
|
||||
protected readonly EntityManagerInterface $entityManager,
|
||||
protected readonly HttpClientInterface $httpClient
|
||||
) {}
|
||||
)
|
||||
{
|
||||
$this->httpClient = HttpClient::create([
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws TransportExceptionInterface
|
||||
* @throws ServerExceptionInterface
|
||||
* @throws RedirectionExceptionInterface
|
||||
* @throws ClientExceptionInterface
|
||||
*/
|
||||
public function __invoke(Client $client): JsonResponse
|
||||
{
|
||||
if (!$client->getIp()) {
|
||||
|
@ -34,10 +48,7 @@ class StatusAction extends AbstractController
|
|||
}
|
||||
|
||||
try {
|
||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status', [
|
||||
'verify_peer' => false,
|
||||
'verify_host' => false,
|
||||
]);
|
||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status');
|
||||
|
||||
$statusCode = $response->getStatusCode();
|
||||
$client->setStatus($statusCode === Response::HTTP_OK ? 'active' : 'off');
|
||||
|
|
Loading…
Reference in New Issue