diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-01-31 09:25:04 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-01-31 10:52:08 +0100 |
| commit | f4bb9bc9762c2fa99d3f72126eb0efc9ace1afa4 (patch) | |
| tree | 6ac237d8c07490fc867b5c1b204e0f1e56abaf4e /addons/web/controllers/main.py | |
| parent | 3c1f9ff1569b0eb808b98481aa8f3380b9903160 (diff) | |
[FIX] im_livechat,web: partial revert of 7f8fe1076660ab
Proxy.load is required by the livechat when it is embedded in an
external page, so that it is able to get the static xml files
(with the correct base_url).
opw-706497
Diffstat (limited to 'addons/web/controllers/main.py')
| -rw-r--r-- | addons/web/controllers/main.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 3e6b19adf11..496f234f7e0 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -586,6 +586,22 @@ class WebClient(http.Controller): class Proxy(http.Controller): + @http.route('/web/proxy/load', type='json', auth="none") + def load(self, path): + """ Proxies an HTTP request through a JSON request. + + It is strongly recommended to not request binary files through this, + as the result will be a binary data blob as well. + + :param path: actual request path + :return: file content + """ + from werkzeug.test import Client + from werkzeug.wrappers import BaseResponse + + base_url = request.httprequest.base_url + return Client(request.httprequest.app, BaseResponse).get(path, base_url=base_url).data + @http.route('/web/proxy/post/<path:path>', type='http', auth='user', methods=['GET']) def post(self, path): """Effectively execute a POST request that was hooked through user login""" |
