[FIX] web: format set_profiling output nicely

JSON content can be rendered nicely by browsers when using the
appropriate mimetype

closes odoo/odoo#107708

X-original-commit: 70153bbe233bb81d51752c5f1ed1766414eb875b
Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
This commit is contained in:
Xavier-Do
2022-12-23 12:10:52 +01:00
parent 44dba8e572
commit bc61ab4fb2
+2 -2
View File
@@ -16,9 +16,9 @@ class Profiling(Controller):
profile = profile and profile != '0'
try:
state = request.env['ir.profile'].set_profiling(profile, collectors=collectors, params=params)
return json.dumps(state)
return Response(json.dumps(state), mimetype='application/json')
except UserError as e:
return Response(response='error: %s' % e, status=500)
return Response(response='error: %s' % e, status=500, mimetype='text/plain')
@route(['/web/speedscope', '/web/speedscope/<model("ir.profile"):profile>'], type='http', sitemap=False, auth='user')
def speedscope(self, profile=None):