Skip to content
Snippets Groups Projects
Commit 235f86f4 authored by Adrian Turjak's avatar Adrian Turjak Committed by Claudio Pisa
Browse files

Correctly set content-type for workflow response

The default content-type is html, and under certain
circumstances like devstack the html has some additional
comments added. Because this specific content is meant
to be parsed as json those extra html comments break the
modal.js code.

We can't set the content-type to json without rewriting parts of
modal.js, as it will will parse it into an object early and then
modal.js will fail as it attempts to parse an object into json.

Change-Id: If5a9ee7fe4273dc368dec7767a55d4467bf6a1a7
Closes-bug: #1824484
parent f0473de4
No related branches found
No related tags found
No related merge requests found
......@@ -192,7 +192,8 @@ class ModalFormView(ModalFormMixin, views.HorizonFormView):
field_id = self.request.META[ADD_TO_FIELD_HEADER]
data = [self.get_object_id(handled),
self.get_object_display(handled)]
response = http.HttpResponse(json.dumps(data))
response = http.HttpResponse(
json.dumps(data), content_type="text/plain")
response["X-Horizon-Add-To-Field"] = field_id
elif isinstance(handled, http.HttpResponse):
return handled
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment