Skip to content

fix: curl import fails when --cookie, --location, or --proxy flags appear before URL#354

Open
kimjune01 wants to merge 1 commit into
darrenburns:mainfrom
kimjune01:fix-curl-import-cookies
Open

fix: curl import fails when --cookie, --location, or --proxy flags appear before URL#354
kimjune01 wants to merge 1 commit into
darrenburns:mainfrom
kimjune01:fix-curl-import-cookies

Conversation

@kimjune01
Copy link
Copy Markdown

Description

The curl import parser uses argparse to tokenize curl commands. Flags like --cookie, --location, and --proxy were not registered, so argparse treated their values as positional arguments and assigned them to the url slot. For example, curl --cookie 'session=abc' 'http://example.com' would parse session=abc as the URL.

This registers -b/--cookie, -L/--location, --no-location, and -x/--proxy so they are consumed by their own argument definitions instead of colliding with the URL positional.

Related Issue

Fixes #309

…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.
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.

Inconsistency: curl export format incompatible with curl import

1 participant