Add HEAD and OPTIONS support in PHP client.

The generated PHP client didn't support the HEAD and OPTIONS methods.

Followup on #1156 and #1201.
This commit is contained in:
Arne Jørgensen 2015-09-10 14:55:49 +02:00
parent 4b539a9d6e
commit 3c3762fd92

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);