diff --git a/src/Client.php b/src/Client.php index f4c2e27d..1d189198 100644 --- a/src/Client.php +++ b/src/Client.php @@ -188,8 +188,14 @@ public function sendRequest(Request $request) list($url, $method, $headers, $body) = $this->prepareRequestMessage($request); + $psr7Request = Psr17FactoryDiscovery::findRequestFactory()->createRequest($method, $url); + foreach ($headers as $k => $v) { + $psr7Request = $psr7Request->withHeader($k, $v); + } + $psr7Request = $psr7Request->withBody(Psr17FactoryDiscovery::findStreamFactory()->createStream($body)); + $psr7Response = $this->httpClient->sendRequest( - Psr17FactoryDiscovery::findRequestFactory()->createRequest($method, $url, $headers, $body) + $psr7Request ); static::$requestCount++;