diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 32b77433f0..975db909c6 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -23,10 +23,12 @@ use Utopia\Storage\Device; use Utopia\Storage\Device\Local; use Utopia\Storage\Storage; use Utopia\System\System; +use Utopia\Validator\AnyOf; use Utopia\Validator\Domain; use Utopia\Validator\Integer; use Utopia\Validator\Multiple; use Utopia\Validator\Text; +use Utopia\Validator\URL; use Utopia\Validator\WhiteList; App::get('/v1/health') @@ -397,7 +399,7 @@ App::get('/v1/health/certificate') ], contentType: ContentType::JSON )) - ->param('domain', null, new Multiple([new Domain(), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name') + ->param('domain', null, new Multiple([new AnyOf([new URL(), new Domain()]), new PublicDomain()]), Multiple::TYPE_STRING, 'Domain name') ->inject('response') ->action(function (string $domain, Response $response) { if (filter_var($domain, FILTER_VALIDATE_URL)) { diff --git a/tests/e2e/Services/Health/HealthCustomServerTest.php b/tests/e2e/Services/Health/HealthCustomServerTest.php index 04f4c63ca1..4b7062dc22 100644 --- a/tests/e2e/Services/Health/HealthCustomServerTest.php +++ b/tests/e2e/Services/Health/HealthCustomServerTest.php @@ -453,7 +453,7 @@ class HealthCustomServerTest extends Scope $this->assertIsInt($response['body']['validFrom']); $this->assertIsInt($response['body']['validTo']); - $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=google.com', array_merge([ + $response = $this->client->call(Client::METHOD_GET, '/health/certificate?domain=https://google.com', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), []);