From ddd3e08fbcb54e971537f9f20668c00dbe36ab37 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 15 Jan 2016 16:34:42 +0100 Subject: [PATCH] [FIX] im_livecat: `HttpRequest.render` returns a Response This revision is related to 100d604cb0ebd6aa3f57c9809c6771b0b4b72a07 The above revision aimed to add the correct `content-type` headers, the according route returning Javascript and not simple html. HttpRequest.render` returns a Response, and `make_response` doesn't expect a Response as first argument. In other words, this is not possible to make Reponse from a Response. `HttpRequest.render` accepts kwargs, including `headers`. opw-666898 --- addons/im_livechat/controllers/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/im_livechat/controllers/main.py b/addons/im_livechat/controllers/main.py index 30ae212c8b2..eaf54eaf399 100644 --- a/addons/im_livechat/controllers/main.py +++ b/addons/im_livechat/controllers/main.py @@ -30,8 +30,7 @@ class LivechatController(http.Controller): username = kwargs.get("username", _("Visitor")) channel = request.env['im_livechat.channel'].sudo().browse(channel_id) info = request.env['im_livechat.channel'].get_livechat_info(channel.id, username=username) - js = request.render('im_livechat.loader', {'info': info, 'web_session_required': True}) - return request.make_response(js, headers=[('Content-Type', 'application/javascript')]) + return request.render('im_livechat.loader', {'info': info, 'web_session_required': True}, headers=[('Content-Type', 'application/javascript')]) @http.route('/im_livechat/init', type='json', auth="public") def livechat_init(self, channel_id):