What is the correct Protobuf content type?

前端 未结 1 1597
温柔的废话
温柔的废话 2020-12-24 00:09

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. D

相关标签:
1条回答
  • 2020-12-24 00:52

    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

    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".

    0 讨论(0)
提交回复
热议问题