简体   繁体   English

在 odoo15 中调用端点时得到 301 和 404 错误响应

[英]got 301 and then 404 error response while calling end point in odoo15

here is my code:这是我的代码:

    from odoo import http
_logger = logging.getLogger(__name__)

class CrmController(http.Controller):

    @http.route('/crm/lead', type='json', auth='none', website=True, methods=['POST'])
    def post_data_end_point(self):
        print("==== api called successfully ====")
        return "api called successfully---"

after call this end point on postman i got this error在 postman 上调用此端点后,我收到此错误

2022-09-14 09:44:09,925 167674 INFO odoo15 werkzeug: 127.0.0.1 - - [14/Sep/2022 09:44:09] "POST /crm/lead/ HTTP/1.1" 301 - 35 0.020 0.817
2022-09-14 09:44:10,421 167674 INFO odoo15 werkzeug: 127.0.0.1 - - [14/Sep/2022 09:44:10] "GET /crm/lead HTTP/1.1" 404 - 214 0.116 0.357

you have define type='json' it means it response only json(dictionary) object not string.你定义了type='json'这意味着它只响应 json(dictionary) object 而不是字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM