[FIX] Potential problems with server-side autodetection of request type.

bzr revid: nicolas.vanhoren@openerp.com-20130806152547-2b5puachpvcjsci3
This commit is contained in:
niv-openerp 2013-08-06 17:25:47 +02:00
parent 8039768fc8
commit 67cba2d9c5
1 changed files with 2 additions and 6 deletions

View File

@ -947,13 +947,9 @@ class Root(object):
if httprequest.args.get('jsonp'):
return JsonRequest(httprequest)
content = httprequest.stream.read()
import cStringIO
httprequest.stream = cStringIO.StringIO(content)
try:
simplejson.loads(content)
if httprequest.headers["Content-Type"] == "application/json":
return JsonRequest(httprequest)
except:
else:
return HttpRequest(httprequest)
def load_addons(self):