Skip to content

Commit c408135

Browse files
committed
fix: use HEAD for Database ping instead of GET
1 parent 0672574 commit c408135

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
test:
2+
docker run --rm -it -v $(PWD):/app -w /app/tests php:8.0-cli ../vendor/bin/phpunit
3+
4+
stan:
5+
docker run --rm -it -v $(PWD):/app -w /app php:8.0-cli vendor/bin/phpstan analyse

src/Client.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,11 @@ public function post(string $path, array $data = null): ResponseInterface {
7373
public function delete(string $url, array $options = []): ResponseInterface {
7474
return $this->client->request('DELETE', $url, $options);
7575
}
76+
77+
/**
78+
* @throws GuzzleException
79+
*/
80+
public function head(string $path): ResponseInterface {
81+
return $this->client->request('HEAD', $path);
82+
}
7683
}

src/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function __construct(
1212

1313
public function ping(): bool {
1414
try {
15-
return $this->client->get('/' . $this->name)->getStatusCode() === 200;
15+
return $this->client->head('/' . $this->name)->getStatusCode() === 200;
1616
} catch (GuzzleException) {
1717
return false;
1818
}

0 commit comments

Comments
 (0)