Commit 3b538afa authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Fix API decorator response Content-Type

Remove check for response Content-Type, since 'django.http.HttpResponse'
has always a default Content-Type of 'text/html; charset=utf-8'. Views
defining their response 'Content-Type' should set the
'override_serialization' attribute of response to 'True'.
parent bdea4a6b
......@@ -155,7 +155,7 @@ def get_serialization(request, format_allowed=True):
def update_response_headers(request, response):
if not response.has_header("Content-Type"):
if not getattr(response, "override_serialization", False):
serialization = request.serialization
if serialization == "xml":
response["Content-Type"] = "application/xml; charset=UTF-8"
......
......@@ -934,6 +934,7 @@ def object_read(request, v_account, v_container, v_object):
return response
request.serialization = 'text' # Unset.
response.override_serialization = True
return object_data_response(request, sizes, hashmaps, meta)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment