From c71b5b86a1fd9a5f44f6baa82e69bda0ef2d6935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Galv=C3=A3o?= Date: Mon, 15 Apr 2024 14:15:59 +0200 Subject: [PATCH] Replace php-http/message-factory to psr/http-factory --- src/Common/Http/Client.php | 16 ++++------------ src/Common/Http/ClientInterface.php | 8 +------- tests/Common/Http/ClientTest.php | 12 ------------ 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/Common/Http/Client.php b/src/Common/Http/Client.php index 3dc947ac..590995ea 100644 --- a/src/Common/Http/Client.php +++ b/src/Common/Http/Client.php @@ -36,22 +36,14 @@ public function __construct($httpClient = null, RequestFactoryInterface $request } /** - * @param $method - * @param $uri - * @param array $headers - * @param string|array|resource|StreamInterface|null $body - * @param string $protocolVersion + * @param string $method + * @param string|UriInterface $uri * @return ResponseInterface * @throws \Http\Client\Exception */ public function request( - $method, - $uri, - array $headers = [], - $body = null, - $protocolVersion = '1.1' - ) { - $request = $this->requestFactory->createRequest($method, $uri, $headers, $body, $protocolVersion); + $method, $uri) { + $request = $this->requestFactory->createRequest($method, $uri); return $this->sendRequest($request); } diff --git a/src/Common/Http/ClientInterface.php b/src/Common/Http/ClientInterface.php index 73593957..3f5ae9db 100644 --- a/src/Common/Http/ClientInterface.php +++ b/src/Common/Http/ClientInterface.php @@ -15,9 +15,6 @@ interface ClientInterface * * @param string $method * @param string|UriInterface $uri - * @param array $headers - * @param resource|string|StreamInterface|null $body - * @param string $protocolVersion * * @throws RequestException when the HTTP client is passed a request that is invalid and cannot be sent. * @throws NetworkException if there is an error with the network or the remote server cannot be reached. @@ -26,9 +23,6 @@ interface ClientInterface */ public function request( $method, - $uri, - array $headers = [], - $body = null, - $protocolVersion = '1.1' + $uri ); } diff --git a/tests/Common/Http/ClientTest.php b/tests/Common/Http/ClientTest.php index 74414ffe..c1dbace0 100644 --- a/tests/Common/Http/ClientTest.php +++ b/tests/Common/Http/ClientTest.php @@ -26,9 +26,6 @@ public function testSend() $mockFactory->shouldReceive('createRequest')->withArgs([ 'GET', '/path', - [], - null, - '1.1', ])->andReturn($request); $mockClient->shouldReceive('sendRequest') @@ -52,9 +49,6 @@ public function testSendException() $mockFactory->shouldReceive('createRequest')->withArgs([ 'GET', '/path', - [], - null, - '1.1', ])->andReturn($request); $mockClient->shouldReceive('sendRequest') @@ -79,9 +73,6 @@ public function testSendNetworkException() $mockFactory->shouldReceive('createRequest')->withArgs([ 'GET', '/path', - [], - null, - '1.1', ])->andReturn($request); $mockClient->shouldReceive('sendRequest') @@ -106,9 +97,6 @@ public function testSendExceptionGetRequest() $mockFactory->shouldReceive('createRequest')->withArgs([ 'GET', '/path', - [], - null, - '1.1', ])->andReturn($request); $exception = new \Exception('Something went wrong');