From bc61ab4fb25f4e336d5c782426aa45a900a8feeb Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 26 Oct 2022 07:58:02 +0000 Subject: [PATCH] [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) --- addons/web/controllers/profiling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/controllers/profiling.py b/addons/web/controllers/profiling.py index b320ee0cfba..640f8b4e210 100644 --- a/addons/web/controllers/profiling.py +++ b/addons/web/controllers/profiling.py @@ -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/'], type='http', sitemap=False, auth='user') def speedscope(self, profile=None):