Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5763 มุมมอง

Hello, I want to do a simple json request. But it fails all time with this:

Bad Request

<function className at 0x7fcb5df30aa0>, /test/some_json: Function declared as capable of handling request of type 'json' but called with a request of type 'http'


My code looks like this:


from openerp import SUPERUSER_ID
from openerp import http
from openerp.http import request
import openerp
import json


class MyController(http.Controller):

@http.route('/test/some_json', type="json", auth="public", website=True)
def some_jsons(self):
return [{"sample_dictionary": "This is a sample JSON dictionary"}]


what is wrong here? I have no javascript in my module. 

thanks




อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I think you are calling an HTTP request, but you are handling with type JSON. would be good if you update your question with the call.

อวตาร
ละทิ้ง
ผู้เขียน

I don't have another call. have you an example for me ?

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 17
4473
1
ก.ค. 25
8336
4
มี.ค. 25
42180
1
ก.ย. 20
6437
6
ก.ค. 20
11638