mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
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:
parent
4b539a9d6e
commit
3c3762fd92
@ -48,6 +48,8 @@ class ApiClient
|
|||||||
public static $PATCH = "PATCH";
|
public static $PATCH = "PATCH";
|
||||||
public static $POST = "POST";
|
public static $POST = "POST";
|
||||||
public static $GET = "GET";
|
public static $GET = "GET";
|
||||||
|
public static $HEAD = "HEAD";
|
||||||
|
public static $OPTIONS = "OPTIONS";
|
||||||
public static $PUT = "PUT";
|
public static $PUT = "PUT";
|
||||||
public static $DELETE = "DELETE";
|
public static $DELETE = "DELETE";
|
||||||
|
|
||||||
@ -170,6 +172,11 @@ class ApiClient
|
|||||||
if ($method == self::$POST) {
|
if ($method == self::$POST) {
|
||||||
curl_setopt($curl, CURLOPT_POST, true);
|
curl_setopt($curl, CURLOPT_POST, true);
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
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) {
|
} else if ($method == self::$PATCH) {
|
||||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user