-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
Description
Description
Acceptance Criteria
- Save a MapLocalEntry as an Array. We don't need to support Tree View (Folder Mode) like the macOS.
- Implement the MapLocalService and RuleStorageService
- MapLocalService must be subclassed from RuleStorageService
- RuleStorageService can be reused for other debugging tools, such as BlockListService, BreakpointService because they are sharing the same logic
- The data is saved under App Data Directory. Don't save it in AppConfig.
RuleStorageService
RuleStorageService class will have matching fun, which accepts a Request.
func matching(_ url: String, request: Request) -> T? {
guard isEnabled,
!entries.isEmpty else { return nil }
return entries.first(where: { $0.matching(url, request: request) })
}- It passes the logic to check which rule is matching to each Entry (In this case, it's the Map Local Entry)
Mapping Logic: ToolService class
- Implement the ToolService class.
- As soon as the Request in the Flow is created -> We pass it through the ToolService to determine which Tool is executed.
- ToolService would check all available debugging tools, e.g. Block List, White List, Breakpoint, Map Local
Mapping Logic: Change the Response
- ✅ Important Logic: If a flow is matched with Map Local (check by the ToolService) -> Make sure the Flow never goes to the real Server -> The Server will return a Response (which is built by the MapLocalServer)
- It enables the Mock API feature from the Map Local Tool -> Read ticket for further information.
✅ How to test (Happy case on macOS)
- Use Insomnia: Make a real API call to
httpbin.org - The new request appears on the main view
- Right Click -> Tools -> Map Local
- Automatically create a Map Local Rule -> Open the Editor -> The Editor must show the body of the
httpbin.org - Go back to the Insomnia app -> Make an API again -> At this point: The API is a success and we can see the body.
- Back Proxyman app -> Map Local Editor -> Try to edit the Status Code, Header, Body -> Save -> Go to Insomnia -> New Response data is displayed.
✅ How to test (Happy case on iPhone)
- Set up Proxyman with your iPhone properly. Download the Product Hunt iOS app.
- Use the Product Hunt iOS app -> Load the Home View
- The new request appears on the main view
- Right Click -> Tools -> Map Local
- Automatically create a Map Local Rule -> The Editor must show the real Response Raw Message
- Try to edit the Name Product on the Response Body.
- Go back to the Product Hunt iOS app -> Pull to request on the Home Screen -> Make sure the UI is changed with the new Name Product.