diff --git a/src/Contracts/TransporterInterface.php b/src/Contracts/TransporterInterface.php index f79b519..5e7048a 100644 --- a/src/Contracts/TransporterInterface.php +++ b/src/Contracts/TransporterInterface.php @@ -7,7 +7,5 @@ interface TransporterInterface { - public function request(string $method, string $path, array $options = []): Response; - public function send(Request $request): Response; } diff --git a/src/Transporters/HttpTransporter.php b/src/Transporters/HttpTransporter.php index b529a34..d4b5c49 100644 --- a/src/Transporters/HttpTransporter.php +++ b/src/Transporters/HttpTransporter.php @@ -18,19 +18,6 @@ public function __construct( private readonly Headers $headers, ) {} - /** - * @deprecated use send method instead - */ - public function request(string $method, string $path, array $options = []): Response - { - $request = (new Request()) - ->withMethod($method) - ->withUrl($this->baseUrl->append($path)) - ->withBody($options['body'] ?? null); - - return $this->send($request); - } - public function send(Request $request): Response { $request = $request diff --git a/tests/Mocks/MockTransporter.php b/tests/Mocks/MockTransporter.php index a23e1c9..29f18b0 100644 --- a/tests/Mocks/MockTransporter.php +++ b/tests/Mocks/MockTransporter.php @@ -13,11 +13,6 @@ class MockTransporter implements TransporterInterface */ public function __construct(private array $responses) {} - public function request(string $method, string $path, array $options = []): Response - { - return $this->send((new Request())->withMethod($method)->withUrl($path)); - } - private function searchForResponse(Request $request): ?Response { foreach ($this->responses as $key => $response) { diff --git a/tests/Transporters/HttpTransporterTest.php b/tests/Transporters/HttpTransporterTest.php index 9088cec..3e0e9da 100644 --- a/tests/Transporters/HttpTransporterTest.php +++ b/tests/Transporters/HttpTransporterTest.php @@ -3,6 +3,7 @@ use GuzzleHttp\Psr7\Response; use HeyJorgeDev\QStash\Transporters\HttpTransporter; use HeyJorgeDev\QStash\ValueObjects\Transporter\Headers; +use HeyJorgeDev\QStash\ValueObjects\Transporter\Request; use HeyJorgeDev\QStash\ValueObjects\Url; use Psr\Http\Client\ClientInterface; @@ -14,7 +15,7 @@ $transporter = new HttpTransporter($client, new Url('https://example.com'), new Headers([])); - $response = $transporter->request('GET', 'http://example.com', []); + $response = $transporter->send(Request::GET('http://example.com')); expect($response) ->statusCode->toBe(200)