diff --git a/swh/core/api/asynchronous.py b/swh/core/api/asynchronous.py index eed981ed68c7bb332f00aa15a167cb518e530964..7c717c811f81d1b45e1cdfb8de3b4d8ab915b0bd 100644 --- a/swh/core/api/asynchronous.py +++ b/swh/core/api/asynchronous.py @@ -22,7 +22,8 @@ def encode_data_server(data, **kwargs): 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 index 19ef7597b991c733e3a4ed6e78c7476f4ba52215..e51d74085a7aa5227c961644cf64b093c11a9ec0 100644 --- a/swh/core/db/__init__.py +++ b/swh/core/db/__init__.py @@ -92,7 +92,7 @@ class BaseDb: 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