feat: parse pasted curl commands in URL bar#4
Open
fprotimaru wants to merge 1 commit intobajrangCoder:mainfrom
Open
feat: parse pasted curl commands in URL bar#4fprotimaru wants to merge 1 commit intobajrangCoder:mainfrom
fprotimaru wants to merge 1 commit intobajrangCoder:mainfrom
Conversation
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>
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.
Summary
curl ...command into the URL bar auto-fills the active tab's method, URL, headers, and body.src/utils/curl_parser.rshandles 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.-F, JSON by content-type or shape, urlencoded if pairs, otherwise text). Method defaults to POST when data is present and-Xis absent. JSON bodies are pretty-printed before being placed in the editor.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)curlinto the URL bar — method=POST, URL set,Content-Type: application/jsonin headers, JSON body pretty-printed in Body tabcurl -Fmultipart command — multipart editor populates-u user:pass—Authorization: Basic ...addedcurlprefix) — no parsing kicks in🤖 Generated with Claude Code