Cross-domain issues odoo Controller POST request interface development solution

Cross-domain issues odoo Controller POST request interface development solution

1, odoo Controller interface development, the front end cross-domain problem occurs when requested, given the information as follows:
Function declared as capable of handling request of type 'json' but called with a request of type 'http'

2、解决方法如下:
      odoo官网给的参数解释: cors – The Access-Control-Allow-Origin cors directive value.

            可以在Controller接口上配置参数,如:
            `@http.route("/", type='json', auth="none", csrf=False, method=["POST"],
            website=True, cors="*")`
            这样前端在进行接口调用的时候,就可以调通了,跨域问题就解决了。

Guess you like

Origin blog.51cto.com/siweilai/2418816