Skip to content

Commit

Permalink
Remove stub server health check
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Mar 21, 2023
1 parent 57befc8 commit 0546c98
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace PhpPact\Standalone\StubService\Service;

use PhpPact\Exception\ConnectionException;
use PhpPact\Http\ClientInterface;
use PhpPact\Standalone\StubService\StubServerConfigInterface;

Expand Down Expand Up @@ -36,30 +35,6 @@ public function __construct(ClientInterface $client, StubServerConfigInterface $
$this->config = $config;
}

/**
* {@inheritdoc}
*/
public function healthCheck(): bool
{
$uri = $this->config->getBaseUri()->withPath('/');

$response = $this->client->get($uri, [
'headers' => [
'Content-Type' => 'application/json',
'X-Pact-Mock-Service' => true,
],
]);

$body = $response->getBody()->getContents();

if ($response->getStatusCode() !== 200
|| $body !== "Stub service running\n") {
throw new ConnectionException('Failed to receive a successful response from the Stub Server.');
}

return true;
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,11 @@

namespace PhpPact\Standalone\StubService\Service;

use PhpPact\Exception\ConnectionException;

/**
* Interface StubServerHttpServiceInterface.
*/
interface StubServerHttpServiceInterface
{
/**
* Verify that the Ruby PhpPact Stub Server is running.
*
* @throws ConnectionException
*
* @return bool
*/
public function healthCheck(): bool;

/**
* Get the current state of the PACT JSON file and write it to disk.
*
Expand Down

0 comments on commit 0546c98

Please sign in to comment.