Fix adding dependency package to environment with debreach
When using the debreach random comment middleware with Django, the API response when adding a dependency package to an environment would end up with a html-style comment at the end of the response, which would then fail JSON parsing by the dashboard. To prevent debreach from adding the random data, the content type needs to be something other than text/html. The response output itself isn't really JSON so switching to JsonResponse doesn't work becuase the content isn't a dict, so just use text/plain instead. Change-Id: Ie710487d865344c9a5cd71d4dec3bf927cfabf40
This commit is contained in:
parent
3342531a81
commit
be8d112153
|
@ -419,9 +419,9 @@ class Wizard(generic_views.PageTitleMixin, views.ModalFormMixin, LazyWizard):
|
|||
# that way until we move here from django Wizard to horizon workflow
|
||||
if views.ADD_TO_FIELD_HEADER in self.request.META:
|
||||
field_id = self.request.META[views.ADD_TO_FIELD_HEADER]
|
||||
response = http.HttpResponse(json.dumps(
|
||||
[obj_id, html.escape(obj_name)]
|
||||
))
|
||||
response = http.HttpResponse(
|
||||
json.dumps([obj_id, html.escape(obj_name)]),
|
||||
content_type='text/plain')
|
||||
response["X-Horizon-Add-To-Field"] = field_id
|
||||
return response
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue