forked from loafle/openapi-generator-original
Merge pull request #2418 from scottrw93/i2410
Issue 2410: Suport HTTP body for DELETE operation
This commit is contained in:
commit
e8c3b5e78c
@ -371,7 +371,8 @@ class ApiClient(object):
|
||||
elif method == "DELETE":
|
||||
return self.rest_client.DELETE(url,
|
||||
query_params=query_params,
|
||||
headers=headers)
|
||||
headers=headers,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
"http method must be `GET`, `HEAD`,"
|
||||
|
@ -133,8 +133,8 @@ class RESTClientObject(object):
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
try:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS']:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
||||
if query_params:
|
||||
url += '?' + urlencode(query_params)
|
||||
if headers['Content-Type'] == 'application/json':
|
||||
@ -154,7 +154,7 @@ class RESTClientObject(object):
|
||||
fields=post_params,
|
||||
encode_multipart=True,
|
||||
headers=headers)
|
||||
# For `GET`, `HEAD`, `DELETE`
|
||||
# For `GET`, `HEAD`
|
||||
else:
|
||||
r = self.pool_manager.request(method, url,
|
||||
fields=query_params,
|
||||
@ -195,10 +195,11 @@ class RESTClientObject(object):
|
||||
post_params=post_params,
|
||||
body=body)
|
||||
|
||||
def DELETE(self, url, headers=None, query_params=None):
|
||||
def DELETE(self, url, headers=None, query_params=None, body=None):
|
||||
return self.request("DELETE", url,
|
||||
headers=headers,
|
||||
query_params=query_params)
|
||||
query_params=query_params,
|
||||
body=body)
|
||||
|
||||
def POST(self, url, headers=None, query_params=None, post_params=None, body=None):
|
||||
return self.request("POST", url,
|
||||
|
@ -371,7 +371,8 @@ class ApiClient(object):
|
||||
elif method == "DELETE":
|
||||
return self.rest_client.DELETE(url,
|
||||
query_params=query_params,
|
||||
headers=headers)
|
||||
headers=headers,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
"http method must be `GET`, `HEAD`,"
|
||||
|
@ -133,8 +133,8 @@ class RESTClientObject(object):
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
try:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS']:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
||||
if query_params:
|
||||
url += '?' + urlencode(query_params)
|
||||
if headers['Content-Type'] == 'application/json':
|
||||
@ -154,7 +154,7 @@ class RESTClientObject(object):
|
||||
fields=post_params,
|
||||
encode_multipart=True,
|
||||
headers=headers)
|
||||
# For `GET`, `HEAD`, `DELETE`
|
||||
# For `GET`, `HEAD`
|
||||
else:
|
||||
r = self.pool_manager.request(method, url,
|
||||
fields=query_params,
|
||||
@ -195,10 +195,11 @@ class RESTClientObject(object):
|
||||
post_params=post_params,
|
||||
body=body)
|
||||
|
||||
def DELETE(self, url, headers=None, query_params=None):
|
||||
def DELETE(self, url, headers=None, query_params=None, body=None):
|
||||
return self.request("DELETE", url,
|
||||
headers=headers,
|
||||
query_params=query_params)
|
||||
query_params=query_params,
|
||||
body=body)
|
||||
|
||||
def POST(self, url, headers=None, query_params=None, post_params=None, body=None):
|
||||
return self.request("POST", url,
|
||||
|
Loading…
x
Reference in New Issue
Block a user