mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
[python] check output content-type only if preload_content is set (#7847)
This commit is contained in:
@@ -200,8 +200,6 @@ class ApiClient(object):
|
||||
e.body = e.body.decode('utf-8') if six.PY3 else e.body
|
||||
raise e
|
||||
|
||||
content_type = response_data.getheader('content-type')
|
||||
|
||||
self.last_response = response_data
|
||||
|
||||
return_data = response_data
|
||||
@@ -218,6 +216,7 @@ class ApiClient(object):
|
||||
|
||||
if six.PY3 and response_type not in ["file", "bytes"]:
|
||||
match = None
|
||||
content_type = response_data.getheader('content-type')
|
||||
if content_type is not None:
|
||||
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
|
||||
encoding = match.group(1) if match else "utf-8"
|
||||
|
||||
@@ -191,8 +191,6 @@ class ApiClient(object):
|
||||
e.body = e.body.decode('utf-8') if six.PY3 else e.body
|
||||
raise e
|
||||
|
||||
content_type = response_data.getheader('content-type')
|
||||
|
||||
self.last_response = response_data
|
||||
|
||||
return_data = response_data
|
||||
@@ -204,6 +202,7 @@ class ApiClient(object):
|
||||
|
||||
if six.PY3 and response_type not in ["file", "bytes"]:
|
||||
match = None
|
||||
content_type = response_data.getheader('content-type')
|
||||
if content_type is not None:
|
||||
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
|
||||
encoding = match.group(1) if match else "utf-8"
|
||||
|
||||
@@ -192,8 +192,6 @@ class ApiClient(object):
|
||||
e.body = e.body.decode('utf-8') if six.PY3 else e.body
|
||||
raise e
|
||||
|
||||
content_type = response_data.getheader('content-type')
|
||||
|
||||
self.last_response = response_data
|
||||
|
||||
return_data = response_data
|
||||
@@ -205,6 +203,7 @@ class ApiClient(object):
|
||||
|
||||
if six.PY3 and response_type not in ["file", "bytes"]:
|
||||
match = None
|
||||
content_type = response_data.getheader('content-type')
|
||||
if content_type is not None:
|
||||
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
|
||||
encoding = match.group(1) if match else "utf-8"
|
||||
|
||||
@@ -190,8 +190,6 @@ class ApiClient(object):
|
||||
e.body = e.body.decode('utf-8') if six.PY3 else e.body
|
||||
raise e
|
||||
|
||||
content_type = response_data.getheader('content-type')
|
||||
|
||||
self.last_response = response_data
|
||||
|
||||
return_data = response_data
|
||||
@@ -203,6 +201,7 @@ class ApiClient(object):
|
||||
|
||||
if six.PY3 and response_type not in ["file", "bytes"]:
|
||||
match = None
|
||||
content_type = response_data.getheader('content-type')
|
||||
if content_type is not None:
|
||||
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
|
||||
encoding = match.group(1) if match else "utf-8"
|
||||
|
||||
@@ -190,8 +190,6 @@ class ApiClient(object):
|
||||
e.body = e.body.decode('utf-8') if six.PY3 else e.body
|
||||
raise e
|
||||
|
||||
content_type = response_data.getheader('content-type')
|
||||
|
||||
self.last_response = response_data
|
||||
|
||||
return_data = response_data
|
||||
@@ -203,6 +201,7 @@ class ApiClient(object):
|
||||
|
||||
if six.PY3 and response_type not in ["file", "bytes"]:
|
||||
match = None
|
||||
content_type = response_data.getheader('content-type')
|
||||
if content_type is not None:
|
||||
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
|
||||
encoding = match.group(1) if match else "utf-8"
|
||||
|
||||
Reference in New Issue
Block a user