Skip to content

Commit

Permalink
Replace php-http/message-factory to psr/http-factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Fábio Galvão committed Apr 15, 2024
1 parent ba811b5 commit c71b5b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
16 changes: 4 additions & 12 deletions src/Common/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 1 addition & 7 deletions src/Common/Http/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -26,9 +23,6 @@ interface ClientInterface
*/
public function request(
$method,
$uri,
array $headers = [],
$body = null,
$protocolVersion = '1.1'
$uri
);
}
12 changes: 0 additions & 12 deletions tests/Common/Http/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public function testSend()
$mockFactory->shouldReceive('createRequest')->withArgs([
'GET',
'/path',
[],
null,
'1.1',
])->andReturn($request);

$mockClient->shouldReceive('sendRequest')
Expand All @@ -52,9 +49,6 @@ public function testSendException()
$mockFactory->shouldReceive('createRequest')->withArgs([
'GET',
'/path',
[],
null,
'1.1',
])->andReturn($request);

$mockClient->shouldReceive('sendRequest')
Expand All @@ -79,9 +73,6 @@ public function testSendNetworkException()
$mockFactory->shouldReceive('createRequest')->withArgs([
'GET',
'/path',
[],
null,
'1.1',
])->andReturn($request);

$mockClient->shouldReceive('sendRequest')
Expand All @@ -106,9 +97,6 @@ public function testSendExceptionGetRequest()
$mockFactory->shouldReceive('createRequest')->withArgs([
'GET',
'/path',
[],
null,
'1.1',
])->andReturn($request);

$exception = new \Exception('Something went wrong');
Expand Down

0 comments on commit c71b5b8

Please sign in to comment.