odoo Controller接口开发 POST请求的跨域问题解决方法
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="*")` 这样前端在进行接口调用的时候,就可以调通了,跨域问题就解决了。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。