mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.18k stars 186 forks source link

Why message body takes only bytes? Should 'json.dumps' + 'content_type=application/json' be enough? #539

Open jalvespinto opened 1 year ago

jalvespinto commented 1 year ago

Shouldn't self.body = body if isinstance(body, bytes) else bytes(body) use something like _as_bytes instead of bytes?

Aurvandill commented 1 year ago

You could take a look at class JsonRPC(RPC): in aio_pika/patterns/rpc.py Where you can pass json directly.