forked from loafle/openapi-generator-original
[Python] remove default content-type in the request (#10782)
* remove default content-type in the request * add remove default content-type test * fix duplicate content type * update sample * add missing params * update sample * only assign content type if exist * update sample * update sample * format code * update sample
This commit is contained in:
@@ -151,10 +151,12 @@ class AnotherFakeApi(object):
|
||||
['application/json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json'],
|
||||
'PATCH', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
|
||||
@@ -147,10 +147,12 @@ class FakeApi(object):
|
||||
if 'xml_item' in local_var_params:
|
||||
body_params = local_var_params['xml_item']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
@@ -821,10 +823,12 @@ class FakeApi(object):
|
||||
if 'body' in local_var_params:
|
||||
body_params = local_var_params['body']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json'],
|
||||
'PUT', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
@@ -968,10 +972,12 @@ class FakeApi(object):
|
||||
if 'body' in local_var_params:
|
||||
body_params = local_var_params['body']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json'],
|
||||
'PUT', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
@@ -1110,10 +1116,12 @@ class FakeApi(object):
|
||||
['application/json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json'],
|
||||
'PATCH', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
@@ -1381,10 +1389,12 @@ class FakeApi(object):
|
||||
|
||||
body_params = None
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/x-www-form-urlencoded'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['http_basic_test'] # noqa: E501
|
||||
@@ -1567,10 +1577,12 @@ class FakeApi(object):
|
||||
|
||||
body_params = None
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/x-www-form-urlencoded'],
|
||||
'GET', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
@@ -1878,10 +1890,12 @@ class FakeApi(object):
|
||||
if 'param' in local_var_params:
|
||||
body_params = local_var_params['param']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
@@ -2025,10 +2039,12 @@ class FakeApi(object):
|
||||
|
||||
body_params = None
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/x-www-form-urlencoded'],
|
||||
'GET', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = [] # noqa: E501
|
||||
|
||||
@@ -151,10 +151,12 @@ class FakeClassnameTags123Api(object):
|
||||
['application/json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json'],
|
||||
'PATCH', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['api_key_query'] # noqa: E501
|
||||
|
||||
@@ -145,10 +145,12 @@ class PetApi(object):
|
||||
if 'body' in local_var_params:
|
||||
body_params = local_var_params['body']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json', 'application/xml'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['petstore_auth'] # noqa: E501
|
||||
@@ -838,10 +840,12 @@ class PetApi(object):
|
||||
if 'body' in local_var_params:
|
||||
body_params = local_var_params['body']
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/json', 'application/xml'],
|
||||
'PUT', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['petstore_auth'] # noqa: E501
|
||||
@@ -988,10 +992,12 @@ class PetApi(object):
|
||||
|
||||
body_params = None
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['application/x-www-form-urlencoded'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['petstore_auth'] # noqa: E501
|
||||
@@ -1142,10 +1148,12 @@ class PetApi(object):
|
||||
['application/json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['multipart/form-data'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['petstore_auth'] # noqa: E501
|
||||
@@ -1302,10 +1310,12 @@ class PetApi(object):
|
||||
['application/json']) # noqa: E501
|
||||
|
||||
# HTTP header `Content-Type`
|
||||
header_params['Content-Type'] = local_var_params.get('_content_type',
|
||||
content_types_list = local_var_params.get('_content_type',
|
||||
self.api_client.select_header_content_type(
|
||||
['multipart/form-data'],
|
||||
'POST', body_params)) # noqa: E501
|
||||
if content_types_list:
|
||||
header_params['Content-Type'] = content_types_list
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['petstore_auth'] # noqa: E501
|
||||
|
||||
@@ -531,7 +531,7 @@ class ApiClient(object):
|
||||
:return: Content-Type (e.g. application/json).
|
||||
"""
|
||||
if not content_types:
|
||||
return 'application/json'
|
||||
return None
|
||||
|
||||
content_types = [x.lower() for x in content_types]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user