Merge pull request #1210 from arnested/missing-head-and-options-in-php-client

Add HEAD and OPTIONS support in PHP client.
This commit is contained in:
wing328 2015-09-10 22:07:31 +08:00
commit b3db24ead6

View File

@ -48,6 +48,8 @@ class ApiClient
public static $PATCH = "PATCH";
public static $POST = "POST";
public static $GET = "GET";
public static $HEAD = "HEAD";
public static $OPTIONS = "OPTIONS";
public static $PUT = "PUT";
public static $DELETE = "DELETE";
@ -170,6 +172,11 @@ class ApiClient
if ($method == self::$POST) {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$HEAD) {
curl_setopt($curl, CURLOPT_NOBODY, true);
} else if ($method == self::$OPTIONS) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$PATCH) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);