Add protobuf support to network inspector (#2080)
Summary: Protobuf based APIs are becoming more common (i.e. gRPC) but are difficult to inspect. Unlike plain text data formats (JSON), Protobuf calls transmit binary data requiring the format to be known ahead of time, making ad-hoc inspection impossible. This PR allows for those format definitions (messages in protobuf terminology) to be transmitted from the client to the network inspector plugin. These definitions are then imported into ProtobufJS which enables the binary data transmitted to be inspected as easily as JSON data. See Retrofit PR in https://github.com/facebook/flipper/pull/2084 ## Changelog * Add ProtobufJS library to network plugin * New `ProtobufFormatter` UI in `RequestDetails` * `ProtobufDefinitionsRepository` to cache and load protobuf defintions * `addProtobufDefinitions` call in the Android network plugin Pull Request resolved: https://github.com/facebook/flipper/pull/2080 Test Plan:  Reviewed By: mweststrate Differential Revision: D27507451 Pulled By: passy fbshipit-source-id: 586d891b74f2b17d28fe7a2a99074da755851f38
This commit is contained in:
committed by
Facebook GitHub Bot
parent
451c332260
commit
4d262c0da4
@@ -127,6 +127,19 @@ public class NetworkFlipperPlugin extends BufferingFlipperPlugin implements Netw
|
||||
job.run();
|
||||
}
|
||||
|
||||
public void addProtobufDefinitions(
|
||||
final String baseUrl, final FlipperArray callNestedMessagesPayloads) {
|
||||
(new ErrorReportingRunnable(getConnection()) {
|
||||
@Override
|
||||
protected void runOrThrow() throws Exception {
|
||||
send(
|
||||
"addProtobufDefinitions",
|
||||
new FlipperObject.Builder().put(baseUrl, callNestedMessagesPayloads).build());
|
||||
}
|
||||
})
|
||||
.run();
|
||||
}
|
||||
|
||||
private String toBase64(@Nullable byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user