This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 958
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Network plugin - Support formatting network request (#5652)
Summary: The network plugin allows for formatting network responses, making it possible to convert protobuf messages into a human-readable format. However, there is currently no method to format network request bodies. This PR introduces a NetworkRequestFormatter to address this issue. ## Changelog Network plugin: Support formatting request body Pull Request resolved: #5652 Test Plan: Here we intercepted the network call and modified the request and response bodies <img width="1280" alt="Screenshot 2024-07-11 at 23 13 58" src="https://github.com/user-attachments/assets/5bd20884-0ffc-48cf-867e-c74c4b6735df"> Reviewed By: antonk52 Differential Revision: D59750064 Pulled By: passy fbshipit-source-id: 787227184d5609e9fdb3f07962b7cff0e972726f
- Loading branch information
1 parent
9ad0a15
commit ea91782
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...s/network/src/main/java/com/facebook/flipper/plugins/network/NetworkRequestFormatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.facebook.flipper.plugins.network; | ||
|
||
public interface NetworkRequestFormatter { | ||
interface OnCompletionListener { | ||
void onCompletion(String json); | ||
} | ||
|
||
boolean shouldFormat(NetworkReporter.RequestInfo request); | ||
|
||
void format(NetworkReporter.RequestInfo request, OnCompletionListener onCompletionListener); | ||
} |