Skip to content

Commit c71b5b8

Browse files
author
Fábio Galvão
committed
Replace php-http/message-factory to psr/http-factory
1 parent ba811b5 commit c71b5b8

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

src/Common/Http/Client.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,14 @@ public function __construct($httpClient = null, RequestFactoryInterface $request
3636
}
3737

3838
/**
39-
* @param $method
40-
* @param $uri
41-
* @param array $headers
42-
* @param string|array|resource|StreamInterface|null $body
43-
* @param string $protocolVersion
39+
* @param string $method
40+
* @param string|UriInterface $uri
4441
* @return ResponseInterface
4542
* @throws \Http\Client\Exception
4643
*/
4744
public function request(
48-
$method,
49-
$uri,
50-
array $headers = [],
51-
$body = null,
52-
$protocolVersion = '1.1'
53-
) {
54-
$request = $this->requestFactory->createRequest($method, $uri, $headers, $body, $protocolVersion);
45+
$method, $uri) {
46+
$request = $this->requestFactory->createRequest($method, $uri);
5547

5648
return $this->sendRequest($request);
5749
}

src/Common/Http/ClientInterface.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ interface ClientInterface
1515
*
1616
* @param string $method
1717
* @param string|UriInterface $uri
18-
* @param array $headers
19-
* @param resource|string|StreamInterface|null $body
20-
* @param string $protocolVersion
2118
*
2219
* @throws RequestException when the HTTP client is passed a request that is invalid and cannot be sent.
2320
* @throws NetworkException if there is an error with the network or the remote server cannot be reached.
@@ -26,9 +23,6 @@ interface ClientInterface
2623
*/
2724
public function request(
2825
$method,
29-
$uri,
30-
array $headers = [],
31-
$body = null,
32-
$protocolVersion = '1.1'
26+
$uri
3327
);
3428
}

tests/Common/Http/ClientTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public function testSend()
2626
$mockFactory->shouldReceive('createRequest')->withArgs([
2727
'GET',
2828
'/path',
29-
[],
30-
null,
31-
'1.1',
3229
])->andReturn($request);
3330

3431
$mockClient->shouldReceive('sendRequest')
@@ -52,9 +49,6 @@ public function testSendException()
5249
$mockFactory->shouldReceive('createRequest')->withArgs([
5350
'GET',
5451
'/path',
55-
[],
56-
null,
57-
'1.1',
5852
])->andReturn($request);
5953

6054
$mockClient->shouldReceive('sendRequest')
@@ -79,9 +73,6 @@ public function testSendNetworkException()
7973
$mockFactory->shouldReceive('createRequest')->withArgs([
8074
'GET',
8175
'/path',
82-
[],
83-
null,
84-
'1.1',
8576
])->andReturn($request);
8677

8778
$mockClient->shouldReceive('sendRequest')
@@ -106,9 +97,6 @@ public function testSendExceptionGetRequest()
10697
$mockFactory->shouldReceive('createRequest')->withArgs([
10798
'GET',
10899
'/path',
109-
[],
110-
null,
111-
'1.1',
112100
])->andReturn($request);
113101

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

0 commit comments

Comments
 (0)