Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
heyjorgedev committed Jul 17, 2024
1 parent 7233b8c commit 839697b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
2 changes: 0 additions & 2 deletions src/Contracts/TransporterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@

interface TransporterInterface
{
public function request(string $method, string $path, array $options = []): Response;

public function send(Request $request): Response;
}
13 changes: 0 additions & 13 deletions src/Transporters/HttpTransporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions tests/Mocks/MockTransporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion tests/Transporters/HttpTransporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down

0 comments on commit 839697b

Please sign in to comment.