콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
23591 화면

I have an ionic 4 application and i try to call odoo jsonrpc but when request reached to the server there I see the log like '/web/session/authenticate: Function declared as capable of handling request of type 'JSON' but called with a request of type 'HTTP''

Same request i send from postman it works. but from Ionic4 HttpClient post request not responding.

Also when i sent request from C# desktop application it's working good.

아바타
취소
작성자 베스트 답변

Hello @Cybrosys,

Thanks for your post.

If we have changed as you suggested in odoo12e/addons/web/controllers/main.py 

@http.route('/web/session/authenticate', type='http', auth="none")

    def authenticate(self, db, login, password, base_location=None):

        request.session.authenticate(db, login, password)

        return request.env['ir.http'].session_info()

It stopped working even in postman.


If we set type='json' it will works in postman, but after changed to type='http' it stopped works.


아바타
취소

Hi @Ethics Infotech LLP,

Please check the updated answer

베스트 답변

Hi ,
If you added type = 'json' in your route
 eg:

 @http.route('/path', type='json', auth='public', method=['POST'], csrf=False)

Then you'll get this error "Function declared as capable of handling request of type 'json' but called with a request of type 'http'" .So change the type  to type='http'.
Please check the below example



Hope it helps

아바타
취소
베스트 답변

Hi,

The default authentication method. ie, /web/session/authenticate is of the type json, so you need to set the request type as json instead of http while you try to authenticate from the app that you develop.

Even in the postman application while calling this route you have to set the type as json else you wont get succeeded,


Thanks

아바타
취소