diff --git a/Modules/_librabbitmq/connection.c b/Modules/_librabbitmq/connection.c index 8f0f8f4..5983f3b 100644 --- a/Modules/_librabbitmq/connection.c +++ b/Modules/_librabbitmq/connection.c @@ -1340,7 +1340,11 @@ PyRabbitMQ_recv(PyRabbitMQ_Connection *self, PyObject *p, *buf++ = *bufp++, j++); } if (p) { - if (!payload) goto error; + if (body_target && !payload) //We expected content, got none + goto error; + else if (!payload) //We expected no content, return emptystring + payload = PyString_FromStringAndSize(NULL, 0); + PyDict_SetItemString(p, "properties", propdict); PyDict_SetItemString(p, "body", payload); PyDict_SetItemString(p, "channel", channel);