feat: Implement route override send and UI#80
Open
tengfeisky wants to merge 2 commits intorepplus:mainfrom
Open
feat: Implement route override send and UI#80tengfeisky wants to merge 2 commits intorepplus:mainfrom
tengfeisky wants to merge 2 commits intorepplus:mainfrom
Conversation
Member
|
Hi @tengfeisky , I really like this feature, let me test it and get back to you asap! |
Member
Greptile OverviewGreptile SummaryImplements a Route Override feature that allows users to reroute captured requests to local services by replacing URL prefixes. This enables developers to replay production requests against local backends for debugging. Key Changes:
Issues Found:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| js/network/url-mapping.js | New module for URL mapping with robust validation, normalization, and localStorage persistence |
| js/network/handler.js | Modified to accept useUrlMapping parameter and apply route overrides before sending requests |
| js/main.js | Added URL mapping modal UI logic with bulk paste functionality, but missing close button handler |
Sequence Diagram
sequenceDiagram
participant User
participant UI as Panel UI
participant Main as main.js
participant Handler as handler.js
participant URLMap as url-mapping.js
participant Storage as localStorage
participant Network as sendRequest
Note over User,Storage: Configure Route Overrides
User->>UI: Click "Route Override" menu
UI->>Main: Open URL mapping modal
Main->>URLMap: getUrlMappings()
URLMap->>Storage: localStorage.getItem('rep_url_mappings')
Storage-->>URLMap: Return stored mappings
URLMap-->>Main: Return normalized mappings
Main->>UI: Display mappings in modal
User->>UI: Add/Edit mappings or paste bulk
User->>UI: Click "Save"
Main->>Main: Validate fields (from & to required)
Main->>URLMap: saveUrlMappings(mappings)
URLMap->>Storage: localStorage.setItem('rep_url_mappings', JSON)
Main->>UI: Show "Route overrides saved" alert
Main->>UI: Close modal
Note over User,Network: Send Request with Override
User->>UI: Click "Send-Override" button
UI->>Main: Event handler triggered
Main->>Handler: handleSendRequest({ useUrlMapping: true })
Handler->>URLMap: getUrlMappings()
URLMap->>Storage: localStorage.getItem('rep_url_mappings')
Storage-->>URLMap: Return stored mappings
URLMap-->>Handler: Return mappings
alt No mappings configured
Handler->>UI: Alert "No route overrides configured"
else Mappings exist
Handler->>URLMap: applyUrlMappings(url, mappings)
URLMap->>URLMap: Check url.startsWith(mapping.from)
URLMap-->>Handler: Return transformed URL
alt URL was transformed
Handler->>Network: sendRequest(targetUrl, options)
Network-->>Handler: Return response
Handler->>UI: Display response
else No mapping matched
Handler->>UI: Alert "No route override matched"
end
end
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Points
Why
makes that quick and reliable.
UI