Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

Commit 281b70c

Browse files
committed
expose underlying HttpClient methods in HttpMethodsClient
1 parent 7ba30ce commit 281b70c

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/HttpMethodsClient.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Http\Client\Exception;
66
use Http\Client\HttpClient;
77
use Http\Message\MessageFactory;
8+
use Psr\Http\Message\RequestInterface;
89
use Psr\Http\Message\ResponseInterface;
910
use Psr\Http\Message\StreamInterface;
1011
use Psr\Http\Message\UriInterface;
@@ -18,10 +19,12 @@
1819
* ->post('/bar')
1920
* ;
2021
*
22+
* The client also exposes the sendRequest methods of the wrapped HttpClient.
23+
*
2124
* @author Márk Sági-Kazár <[email protected]>
2225
* @author David Buchmann <[email protected]>
2326
*/
24-
class HttpMethodsClient
27+
class HttpMethodsClient implements HttpClient
2528
{
2629
/**
2730
* @var HttpClient
@@ -171,9 +174,29 @@ public function options($uri, array $headers = [], $body = null)
171174
}
172175

173176
/**
174-
* Sends a request
177+
* Forward to the underlying HttpClient.
178+
*
179+
* {@inheritdoc}
180+
*/
181+
public function sendRequest(RequestInterface $request)
182+
{
183+
$this->httpClient->sendRequest($request);
184+
}
185+
186+
/**
187+
* Forward to the underlying HttpClient.
188+
*
189+
* {@inheritdoc}
190+
*/
191+
public function sendRequests(array $requests)
192+
{
193+
$this->httpClient->sendRequests($requests);
194+
}
195+
196+
/**
197+
* Sends a request.
175198
*
176-
* @param string $method
199+
* @param string $method HTTP method to use.
177200
* @param string|UriInterface $uri
178201
* @param array $headers
179202
* @param string|StreamInterface|null $body
@@ -184,7 +207,7 @@ public function options($uri, array $headers = [], $body = null)
184207
*/
185208
protected function send($method, $uri, array $headers = [], $body = null)
186209
{
187-
return $this->httpClient->sendRequest($this->messageFactory->createRequest(
210+
return $this->sendRequest($this->messageFactory->createRequest(
188211
$method,
189212
$uri,
190213
'1.1',

0 commit comments

Comments
 (0)