diff --git a/src/Client/Adapter/Curl.php b/src/Client/Adapter/Curl.php index c5a0c953..510590c9 100644 --- a/src/Client/Adapter/Curl.php +++ b/src/Client/Adapter/Curl.php @@ -387,6 +387,9 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = curl_setopt($this->curl, CURLOPT_HTTP_VERSION, $curlHttp); curl_setopt($this->curl, $curlMethod, $curlValue); + // Set the CURLOPT_NOBODY flag for HEAD HTTP method + curl_setopt($this->curl,CURLOPT_NOBODY,$curlMethod === CURLOPT_CUSTOMREQUEST && $curlValue === 'HEAD'); + // Set the CURLINFO_HEADER_OUT flag so that we can retrieve the full request string later curl_setopt($this->curl, CURLINFO_HEADER_OUT, true); diff --git a/test/Client/CurlTest.php b/test/Client/CurlTest.php index 22abe27b..d6e5205e 100644 --- a/test/Client/CurlTest.php +++ b/test/Client/CurlTest.php @@ -365,7 +365,7 @@ public function testGetCurlHandle() */ public function testHeadRequest() { - $this->client->setUri($this->baseuri . 'testRawPostData.php'); + $this->client->setUri($this->baseuri . 'testHeadMethod.php'); $adapter = new Adapter\Curl(); $this->client->setAdapter($adapter); $this->client->setMethod('HEAD'); diff --git a/test/Client/_files/testHeadMethod.php b/test/Client/_files/testHeadMethod.php new file mode 100644 index 00000000..a7a5155c --- /dev/null +++ b/test/Client/_files/testHeadMethod.php @@ -0,0 +1,12 @@ +