Polyconseil / aioamqp

AMQP implementation using asyncio
Other
280 stars 88 forks source link

Why can payload not be empty? #176

Closed madss closed 6 years ago

madss commented 6 years ago

It is currently not possible to send an empty payload with basic_publish because of this assertion. The original commit that introduced the assertion doesn't mention anything about why it was added, but it makes it difficult to send protobuf encoded messages since an empty sequence of bytes is actually a perfectly valid protobuf message.

Is there a technical reason for this or is it purely to prevent people from making mistakes in certain situations? If the latter is the case, I would like to see it removed so it doesn't prevent the use of protobuf.

dzen commented 6 years ago

Hello @madss,

I do not remember why I did put this assertion. Did you test without ?

dzen commented 6 years ago

Okay, it seems the assert is totally useless. Do you want to provide a patch with a test ?

madss commented 6 years ago

Yes, I'll be happy to do that.

madss commented 6 years ago

I've made this pull request: https://github.com/Polyconseil/aioamqp/pull/177

dzen commented 6 years ago

closed with #177