From 3c3762fd92a7cb7036c2bcfa178c9c7fa0d6fd1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Thu, 10 Sep 2015 14:55:49 +0200 Subject: [PATCH] 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. --- .../src/main/resources/php/ApiClient.mustache | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index 3c6819ab73b..8927cbbecb3 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -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);