diff --git a/swh/core/api/asynchronous.py b/swh/core/api/asynchronous.py --- a/swh/core/api/asynchronous.py +++ b/swh/core/api/asynchronous.py @@ -22,7 +22,8 @@ def decode_request(request): content_type = request.headers.get('Content-Type') data = yield from request.read() - + if not data: + return {} if content_type == 'application/x-msgpack': r = msgpack_loads(data) elif content_type == 'application/json': diff --git a/swh/core/db/__init__.py b/swh/core/db/__init__.py --- a/swh/core/db/__init__.py +++ b/swh/core/db/__init__.py @@ -92,7 +92,7 @@ if self.pool: self.pool.putconn(self.conn) - def cursor(self, cur_arg): + def cursor(self, cur_arg=None): """get a cursor: from cur_arg if given, or a fresh one otherwise meant to avoid boilerplate if/then/else in methods that proxy stored