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