diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 5ec6ddbcccc..f62f341045b 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -341,7 +341,9 @@ class ApiClient(object): elif method == "OPTIONS": return self.rest_client.OPTIONS(url, query_params=query_params, - headers=headers) + headers=headers, + post_params=post_params, + body=body) elif method == "POST": return self.rest_client.POST(url, query_params=query_params, diff --git a/modules/swagger-codegen/src/main/resources/python/rest.mustache b/modules/swagger-codegen/src/main/resources/python/rest.mustache index 6279daedec3..07be648373a 100644 --- a/modules/swagger-codegen/src/main/resources/python/rest.mustache +++ b/modules/swagger-codegen/src/main/resources/python/rest.mustache @@ -117,8 +117,8 @@ class RESTClientObject(object): headers['Content-Type'] = 'application/json' try: - # For `POST`, `PUT`, `PATCH` - if method in ['POST', 'PUT', 'PATCH']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS']: if query_params: url += '?' + urlencode(query_params) if headers['Content-Type'] == 'application/json': @@ -138,7 +138,7 @@ class RESTClientObject(object): fields=post_params, encode_multipart=True, headers=headers) - # For `GET`, `HEAD`, `DELETE`, `OPTIONS` + # For `GET`, `HEAD`, `DELETE` else: r = self.pool_manager.request(method, url, fields=query_params, @@ -172,10 +172,12 @@ class RESTClientObject(object): headers=headers, query_params=query_params) - def OPTIONS(self, url, headers=None, query_params=None): + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, body=None): return self.request("OPTIONS", url, headers=headers, - query_params=query_params) + query_params=query_params, + post_params=post_params, + body=body) def DELETE(self, url, headers=None, query_params=None): return self.request("DELETE", url, diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index a9d32c956ef..b44c4a321a6 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -341,7 +341,9 @@ class ApiClient(object): elif method == "OPTIONS": return self.rest_client.OPTIONS(url, query_params=query_params, - headers=headers) + headers=headers, + post_params=post_params, + body=body) elif method == "POST": return self.rest_client.POST(url, query_params=query_params, diff --git a/samples/client/petstore/python/swagger_client/rest.py b/samples/client/petstore/python/swagger_client/rest.py index 6279daedec3..07be648373a 100644 --- a/samples/client/petstore/python/swagger_client/rest.py +++ b/samples/client/petstore/python/swagger_client/rest.py @@ -117,8 +117,8 @@ class RESTClientObject(object): headers['Content-Type'] = 'application/json' try: - # For `POST`, `PUT`, `PATCH` - if method in ['POST', 'PUT', 'PATCH']: + # For `POST`, `PUT`, `PATCH`, `OPTIONS` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS']: if query_params: url += '?' + urlencode(query_params) if headers['Content-Type'] == 'application/json': @@ -138,7 +138,7 @@ class RESTClientObject(object): fields=post_params, encode_multipart=True, headers=headers) - # For `GET`, `HEAD`, `DELETE`, `OPTIONS` + # For `GET`, `HEAD`, `DELETE` else: r = self.pool_manager.request(method, url, fields=query_params, @@ -172,10 +172,12 @@ class RESTClientObject(object): headers=headers, query_params=query_params) - def OPTIONS(self, url, headers=None, query_params=None): + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, body=None): return self.request("OPTIONS", url, headers=headers, - query_params=query_params) + query_params=query_params, + post_params=post_params, + body=body) def DELETE(self, url, headers=None, query_params=None): return self.request("DELETE", url,