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:
@@ -582,7 +582,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]
|
||||
|
||||
@@ -842,10 +842,11 @@ class Endpoint(object):
|
||||
content_type_headers_list = self.headers_map['content_type']
|
||||
if content_type_headers_list:
|
||||
if params['body'] != "":
|
||||
header_list = self.api_client.select_header_content_type(
|
||||
content_types_list = self.api_client.select_header_content_type(
|
||||
content_type_headers_list, self.settings['http_method'],
|
||||
params['body'])
|
||||
params['header']['Content-Type'] = header_list
|
||||
if content_types_list:
|
||||
params['header']['Content-Type'] = content_types_list
|
||||
|
||||
return self.api_client.call_api(
|
||||
self.settings['endpoint_path'], self.settings['http_method'],
|
||||
|
||||
Reference in New Issue
Block a user