odoo接口跨域问题


odoo Controller接口开发 POST请求的跨域问题解决方法

1、odoo Controller接口开发,前端在请求的时候会发生跨域问题,报错信息如下:
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="*") 这样前端在进行接口调用的时候,就可以调通了,跨域问题就解决了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM