gpt4 book ai didi

protocol-buffers - Protobuf : is it true that when an empty protobuf object is sent, 它被转换为空对象?

转载 作者:行者123 更新时间:2023-12-04 08:45:43 30 4
gpt4 key购买 nike

我是protobuf的新用户。
我发现了一些奇怪的行为。
我有两个通过 protobuf 进行通信的服务。
当第一个服务向另一个服务发送一个空的 protobuf 对象时,另一个服务不会得到一个空的 protobuf,而是一个 null。
你有过这样的经历吗?如果是,您知道如何解决吗?我希望其他服务获得一个空对象。

最佳答案

Protobuf 没有 null 的概念;它可以发送零长度的有效负载,并且应该反序列化为空对象(因为空对象的长度为零),但某些实现可能会返回 null。坦率地说,我认为这是反序列化器中的一个错误,但完整的最小重现会有所帮助。

关于protocol-buffers - Protobuf : is it true that when an empty protobuf object is sent, 它被转换为空对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64340698/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com