Skip to content

feat: Implement route override send and UI#80

Open
tengfeisky wants to merge 2 commits intorepplus:mainfrom
tengfeisky:dev-send-local_service
Open

feat: Implement route override send and UI#80
tengfeisky wants to merge 2 commits intorepplus:mainfrom
tengfeisky:dev-send-local_service

Conversation

@tengfeisky
Copy link
Copy Markdown

Key Points

  • Route Override lets you reroute captured requests to local services by prefix replacement.
  • Send-Override sends the current request using the configured overrides.
  • Bulk paste with => per line updates/overwrites existing keys and validates required fields.

Why

  • When you run a local backend for debugging, you often need to replay the same requests without hitting production. Route Override
    makes that quick and reliable.

UI

  • Added a Route Override entry in the More menu with a modal editor.
  • Added a Send-Override button next to Send, with a hover tooltip.

@bscript
Copy link
Copy Markdown
Member

bscript commented Jan 17, 2026

Hi @tengfeisky , I really like this feature, let me test it and get back to you asap!

@bscript
Copy link
Copy Markdown
Member

bscript commented Feb 3, 2026

@greptileai

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

Implements 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:

  • Created js/network/url-mapping.js module to handle URL mapping logic with localStorage persistence and robust normalization
  • Modified handleSendRequest() to accept a useUrlMapping parameter and apply route overrides before sending
  • Added Route Override modal UI with individual row management and bulk paste functionality (key => value format)
  • Added "Send-Override" button next to the existing Send button with tooltip
  • Validation ensures both "from" and "to" fields are required before saving

Issues Found:

  • Missing close button handler for the URL Mapping modal (see inline comment)

Confidence Score: 4/5

  • Safe to merge after fixing the modal close button handler
  • The implementation is well-structured with proper validation and error handling, but has a minor UX issue where the modal close button may not work
  • js/main.js needs a close button handler added for the URL mapping modal

Important Files Changed

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
Loading

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread js/main.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants