Skip to content

feat: parse pasted curl commands in URL bar#4

Open
fprotimaru wants to merge 1 commit intobajrangCoder:mainfrom
fprotimaru:feat/curl-paste-parsing
Open

feat: parse pasted curl commands in URL bar#4
fprotimaru wants to merge 1 commit intobajrangCoder:mainfrom
fprotimaru:feat/curl-paste-parsing

Conversation

@fprotimaru
Copy link
Copy Markdown
Contributor

@fprotimaru fprotimaru commented May 4, 2026

Summary

  • Pasting a curl ... command into the URL bar auto-fills the active tab's method, URL, headers, and body.
  • New src/utils/curl_parser.rs handles shell-style tokenizing (single/double quotes, backslash escapes, \<newline> continuations) and common flags: -X/--request, -H/--header, -d/--data*, -F/--form, -u/--user, -A/--user-agent, -e/--referer, -b/--cookie, --url, -G/--get, --location, -k/--insecure, etc.
  • Body type is inferred (multipart from -F, JSON by content-type or shape, urlencoded if pairs, otherwise text). Method defaults to POST when data is present and -X is absent. JSON bodies are pretty-printed before being placed in the editor.
  • After a successful paste, the URL input is replaced with just the parsed URL and the request view switches to the Body tab when a body is present.

Test plan

  • cargo test (50 tests; 12 new curl-parser tests covering simple GET, explicit method, multiline JSON --data, urlencoded -d, multipart -F, basic auth, the real-world Veon prebid sample)
  • Manual: paste the Veon curl into the URL bar — method=POST, URL set, Content-Type: application/json in headers, JSON body pretty-printed in Body tab
  • Manual: paste a curl -F multipart command — multipart editor populates
  • Manual: paste a curl with -u user:passAuthorization: Basic ... added
  • Manual: type a normal URL (no curl prefix) — no parsing kicks in

🤖 Generated with Claude Code

When a user pastes a `curl ...` command into the URL bar, parse it and
populate the active tab's method, URL, headers, and body. JSON bodies
are pretty-printed before being placed in the editor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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