From 5f375a41834fcc50598aaee07d35297c8ae8e628 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Wed, 11 Apr 2018 23:20:11 +0100 Subject: [PATCH] mgr/dashboard: restcontroller: allow POST with empty body Signed-off-by: Ricardo Dias --- src/pybind/mgr/dashboard/controllers/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: -- 2.39.5