feat(HEAD): CURLOPT_NOBODY option for HEAD requests

* When using HEAD requests set the appropriate curl header to not wait for a response body. See http://www.php.net/manual/en/function.curl-setopt.php on CURLOPT_NOBODY.

* Add simple test for HEAD request.
This commit is contained in:
thenetexperts
2017-02-24 18:06:01 +01:00
committed by Ahmad Nassri
parent 842c0f242d
commit 14aa9aa691
2 changed files with 13 additions and 0 deletions

View File

@@ -399,6 +399,9 @@ class Request
if ($method === Method::POST) {
curl_setopt(self::$handle, CURLOPT_POST, true);
} else {
if ($method === Method::HEAD) {
curl_setopt(self::$handle, CURLOPT_NOBODY, true);
}
curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
}