Skip to content

Fix intermixed optional flags before/after URL on all Pythons - #1946

Open
BetterAndBetterII wants to merge 1 commit into
httpie:masterfrom
BetterAndBetterII:fix/1838-intermixed-options
Open

Fix intermixed optional flags before/after URL on all Pythons#1946
BetterAndBetterII wants to merge 1 commit into
httpie:masterfrom
BetterAndBetterII:fix/1838-intermixed-options

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

  • Switch HTTPieArgumentParser.parse_args to parse_known_intermixed_args() so optional flags may appear before, between, or after positionals on all supported Python versions.
  • Keep --no-* extras working (unlike plain parse_intermixed_args).
  • Add regression tests for three flag positions.

Fixes #1838

Test plan

  • python3.11 -m pytest tests/test_cli.py -k 'TestIntermixedOptions or TestNoOptions'
  • Manual: http --offline --ignore-stdin post pie.dev/post -v 'header1:xyz' x=1 on 3.11
  • Manual: http --offline --ignore-stdin post -v pie.dev/post 'header1:xyz' x=1 on 3.11

Use parse_known_intermixed_args so -v between METHOD and URL (and after
URL on Python < 3.13) no longer drops request items. Keeps --no-* extras.

Fixes httpie#1838
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.

Inconsistent argument parsing behavior across Python versions (< 3.13 vs 3.13+)

1 participant