本文介绍了什么是正确的Protobuf内容类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JSON以 application/json 作为标准.对于protobuf,有些人使用 application/x-protobuf ,但是我看到的东西与.我们是否可以使用RFC或其他一些标准作为参考?

JSON has application/json as a standard. For protobuf some people use application/x-protobuf, but I saw something as odd as application/vnd.google.protobuf being proposed. Do we have an RFC or some other standard that I can use as a reference for this?

推荐答案

有一个建议application/protobuf的IETF提案已过期.它没有解决接收方如何确定特定消息类型的问题.先前的讨论建议使用参数来指定包和消息,例如application/protobuf; proto=org.some.Message

There's an expired IETF proposal that suggests application/protobuf. It does not address the question how the receiving side could determine the particular message type. Previous discussions suggested using a parameter to specify package and message, e.g. application/protobuf; proto=org.some.Message

实际上,您列出的类型似乎确实在使用中,例如监视系统 Prometheus使用application/vnd.google.protobuf ,并且 Charles网络调试代理可以识别application/x-protobuf; messageType="x.y.Z" .

In practice, the types you listed seem to be indeed the ones in use, for example the monitoring system Prometheus uses application/vnd.google.protobuf, and the Charles web debugging proxy recognizes application/x-protobuf; messageType="x.y.Z".

这篇关于什么是正确的Protobuf内容类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 05:31