Skip to content

Conversation

@atulk-code
Copy link

Implements native WebSocket support for HTTPie CLI (Issue #1627), enabling users to connect to WebSocket servers using ws:// and wss:// URL schemes.

…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.
Implements GitHub issue httpie#1627 - WebSocket Support Testing

- Add httpie/websocket.py with WebSocketSession class
- Support ws:// and wss:// URL schemes
- Interactive send/receive mode with Ctrl+C disconnect
- Custom headers, auth, timeout, SSL verify options
- Add comprehensive test suite (19 tests)
@atulk-code atulk-code closed this Feb 7, 2026
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