From: Ricardo Dias Date: Wed, 11 Apr 2018 22:20:11 +0000 (+0100) Subject: mgr/dashboard: restcontroller: allow POST with empty body X-Git-Tag: v13.1.0~234^2~23 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5f375a41834fcc50598aaee07d35297c8ae8e628;p=ceph-ci.git mgr/dashboard: restcontroller: allow POST with empty body Signed-off-by: Ricardo Dias --- diff --git a/src/pybind/mgr/dashboard/controllers/__init__.py b/src/pybind/mgr/dashboard/controllers/__init__.py index c0cef53c1e5..d695578c6cb 100644 --- a/src/pybind/mgr/dashboard/controllers/__init__.py +++ b/src/pybind/mgr/dashboard/controllers/__init__.py @@ -441,8 +441,8 @@ class RESTController(BaseController): content_length = int(cherrypy.request.headers['Content-Length']) body = cherrypy.request.body.read(content_length) if not body: - raise cherrypy.HTTPError(400, 'Empty body. Content-Length={}' - .format(content_length)) + return func(*args, **kwargs) + try: data = json.loads(body.decode('utf-8')) except Exception as e: