Protocol Buffers Descriptor Registry

Charles identifies that an HTTP request or response contains a Protocol Buffers message when the Content-Type header has a MIME type of application/x-protobuf or application/x-google-protobuf.

In order to parse the content Charles needs to know the protobuf type for the message and be able to load the protobuf descriptor for that type. The message type can be specified by:

  1. Giving the fully qualified name of the type in a MIME type parameter (named messageType) as part of the Content-Type header
  2. Configuring a Viewer Mapping for the remote location the message was transported to or from
Similarly there are two ways to supply the descriptor to Charles:
  1. The URL from which the descriptor can be loaded can be given in another MIME type parameter (named desc) as part of the Content-Type header
  2. Add the descriptor file to this registry
A Content-Type header specifying both the descriptor and messageType would look like:

Content-Type: application/x-protobuf; desc="http://server/Model.desc"; messageType="com.sample.Message"

There are two base descriptor files - google.protobuf.desc and unknown.desc - that contain the default message types used by Charles, these descriptors cannot be removed.

Order is important, the descriptors are loaded in the order in which they appear in the registry list, so if you have dependencies between your descriptor files you need to add them in the correct order. Additionally if you have same message type defined in more than one descriptor whichever descriptor is loaded last takes precedence. This means you can overwrite the default set of message types in google.protobuf.desc by adding a new descriptor with updated versions of those message types to your registry.

The Messages list is not editable, it simply allows you to inspect the list of message types contained within the currently loaded descriptor files.