Skip to content

Feature/sequence stdin requests#1

Open
atulk-code wants to merge 2 commits intomasterfrom
feature/sequence-stdin-requests
Open

Feature/sequence stdin requests#1
atulk-code wants to merge 2 commits intomasterfrom
feature/sequence-stdin-requests

Conversation

@atulk-code
Copy link
Copy Markdown
Owner

Implements httpie#1683 - opt-in mechanism to execute multiple
HTTPie requests sequentially from stdin.

Changes:

  • Add --sequence CLI flag in cli/definition.py
  • Create httpie/sequence.py module with:
    • parse_sequence_from_stdin(): parses stdin into request argument lists
    • run_sequence(): executes requests sequentially
  • Integrate early --sequence handling in core.py to bypass URL requirement
  • Add comprehensive test suite in tests/test_sequence.py (10 test cases)

Usage:
cat requests.txt | http --sequence

Where requests.txt contains requests separated by blank lines:
GET https://httpbin.org/get

POST https://httpbin.org/post name=alice

GET https://httpbin.org/headers

Each request uses standard HTTPie argument syntax.

…is present

When Content-Encoding (e.g., gzip) is set, Content-Length represents the
compressed size, but requests library automatically decompresses the response.
This caused a mismatch where downloaded bytes exceeded Content-Length, leading
to false 'Incomplete download' errors.

The fix skips using Content-Length for progress tracking when Content-Encoding
header is present, since the decoded size will differ from the encoded size.

Added test case to verify this behavior.

Fixes httpie#1642
Implements httpie#1683 - opt-in mechanism to execute multiple
HTTPie requests sequentially from stdin.

Changes:
- Add --sequence CLI flag in cli/definition.py
- Create httpie/sequence.py module with:
  - parse_sequence_from_stdin(): parses stdin into request argument lists
  - run_sequence(): executes requests sequentially
- Integrate early --sequence handling in core.py to bypass URL requirement
- Add comprehensive test suite in tests/test_sequence.py (10 test cases)

Usage:
  cat requests.txt | http --sequence

Where requests.txt contains requests separated by blank lines:
  GET https://httpbin.org/get

  POST https://httpbin.org/post name=alice

  GET https://httpbin.org/headers

Each request uses standard HTTPie argument syntax.
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