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

Commit 7b67946

Browse files
authored
Merge pull request #29 from aaa2000/endless-head
Endless head
2 parents 3bb7047 + d891413 commit 7b67946

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## Unreleased
4+
5+
### Fixed
6+
7+
- A HEAD request with the curl handler can be endless
38

49
## 1.0.0 - 2016-07-18
510

src/Client.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ private function createRequest(RequestInterface $request)
7272

7373
$options['version'] = $request->getProtocolVersion();
7474
$options['headers'] = $request->getHeaders();
75-
$options['body'] = (string) $request->getBody();
75+
$body = (string) $request->getBody();
76+
$options['body'] = '' === $body ? null : $body;
7677

7778
return $this->client->createRequest(
7879
$request->getMethod(),

tests/HttpAdapterTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Http\Adapter\Guzzle5\Tests;
44

55
use GuzzleHttp\Client as GuzzleClient;
6+
use GuzzleHttp\Psr7\Request;
67
use Http\Adapter\Guzzle5\Client;
78
use Http\Client\Tests\HttpClientTest;
89
use Http\Message\MessageFactory\GuzzleMessageFactory;
@@ -29,4 +30,16 @@ protected function createHttpAdapter()
2930
* @return object
3031
*/
3132
abstract protected function createHandler();
33+
34+
/**
35+
* @group integration
36+
* @group network
37+
*/
38+
public function testHeadRequestShouldEnd()
39+
{
40+
// It works with the PHP Built-in web server via $request = new Request('GET', $this->getUri());
41+
$request = new Request('HEAD', 'https://httpbin.org/');
42+
$this->httpAdapter->sendRequest($request);
43+
$this->addToAssertionCount(1);
44+
}
3245
}

0 commit comments

Comments
 (0)