Skip to content

Add "Copy as cURL" button to request detail view#2

Open
agaonker wants to merge 1 commit intobazumo:mainfrom
agaonker:agaonker/copy-as-curl
Open

Add "Copy as cURL" button to request detail view#2
agaonker wants to merge 1 commit intobazumo:mainfrom
agaonker:agaonker/copy-as-curl

Conversation

@agaonker
Copy link

@agaonker agaonker commented Feb 3, 2026

Summary

  • Adds a "Copy as cURL" button in the request detail header bar
  • Converts intercepted HTTP requests (method, URL, headers, body)
    into a valid curl command and copies it to the clipboard
  • Shows brief "Copied!" feedback after clicking

Changes

  • src/lib/curl.ts — New utility to convert a Flow into a curl command string. Handles method, headers, body, shell escaping, and multiline formatting.
  • src/components/detail/RequestSection.tsx — Added the copy button between the URL and the view mode toggle.

Test plan

  • Start proxy (npm run dev:server) and dashboard (npm run dev)
  • Send requests through the proxy (e.g. curl -x http://localhost:9090 http://httpbin.org/get)
  • Click an intercepted request in the sidebar
  • Click "Copy as cURL" in the request header bar
  • Paste into terminal and verify the generated curl command is valid and reproduces the original request
  • Verify POST requests with headers and JSON body produce correct output

Screenshots

Screenshot 2026-02-02 at 9 30 41 PM Screenshot 2026-02-02 at 9 31 46 PM Screenshot 2026-02-02 at 9 32 54 PM Screenshot 2026-02-02 at 9 33 46 PM Screenshot 2026-02-02 at 9 34 36 PM Screenshot 2026-02-02 at 9 34 48 PM Screenshot 2026-02-02 at 9 35 05 PM

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.

1 participant