fix: curl import fails when --cookie, --location, or --proxy flags appear before URL#354
Open
kimjune01 wants to merge 1 commit into
Open
fix: curl import fails when --cookie, --location, or --proxy flags appear before URL#354kimjune01 wants to merge 1 commit into
kimjune01 wants to merge 1 commit into
Conversation
…pear before URL Fixes darrenburns#309 When exporting a request to curl, Posting includes flags like --cookie before the URL. However, when importing that same curl command, the argparse parser treats unrecognized flags as positional arguments, causing the URL to be parsed incorrectly. This fix adds support for --cookie (-b), --location (-L), --no-location, and --proxy (-x) flags to the curl import parser, ensuring that the URL is correctly identified even when these flags appear before it. The fix mirrors the approach from PR darrenburns#349 which was closed without merging.
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.
Description
The curl import parser uses
argparseto tokenize curl commands. Flags like--cookie,--location, and--proxywere not registered, soargparsetreated their values as positional arguments and assigned them to theurlslot. For example,curl --cookie 'session=abc' 'http://example.com'would parsesession=abcas the URL.This registers
-b/--cookie,-L/--location,--no-location, and-x/--proxyso they are consumed by their own argument definitions instead of colliding with the URL positional.Related Issue
Fixes #309