feat: Add POST/PUT request support and optional parsing features
Summary
This PR adds four enhancements to the SSE client that improve flexibility while maintaining backward compatibility:
- POST/PUT request support: Enables HTTP methods beyond GET with optional JSON payload support
-
Proxy authentication fix: Corrects proxy parameter names to use
proxy_username/proxy_passwordinstead ofproxy_user/proxy_pass - Optional parsing mode: Adds ability to bypass SSE parsing for raw data streaming use cases
- Optional SSL verification override: Allows disabling SSL verification for development/testing (secure by default)
Changes
POST/PUT Request Support
- Added
http_methodparameter (defaults to "GET") - Added
http_payloadparameter for JSON payloads - Updated request logic to use specified method and payload
Proxy Authentication Fix
- Fixed proxy option parameter names to match expected format
- Changed from
proxy_user/proxy_passtoproxy_username/proxy_password
Optional Parsing Mode
- Added
parseparameter (defaults to true) - When disabled, bypasses SSE parsing and returns raw chunks as events
- Implemented via new
BasicEventParserclass
SSL Verification Override
- Added
verify_sslparameter (defaults to true for security) - When set to false, disables SSL certificate verification
- Useful for development, testing, and internal networks with self-signed certificates
Test plan
- [x] All existing tests pass
- [x] Backward compatibility maintained (all defaults preserve existing behavior)
- [x] Security maintained by default (SSL verification enabled unless explicitly disabled)
- [x] New features tested with existing test suite
Compatibility
All changes are backward compatible - existing code will continue to work exactly as before since all new parameters have sensible defaults that maintain current behavior and security posture.
Hey @saada I am working through the other PR first, and then we can come back to take a look at the remaining changes here. Thank you for your patience!
@saada Thanks for your patience as we wrap up this work.
Most items have been addressed in separate PRs for individual review and are pending release.
Two remaining items:
OpenSSL change: https://github.com/launchdarkly/ruby-eventsource/pull/68 adds support for passing base HTTP options, which should eliminate the need for an explicit constructor option.
Parse option: Could you clarify your use case? If you need "raw streaming," what value does this library provide in that scenario over just connecting and streaming the data directly?
I went ahead and cut a release with the current functionality. If you can let me know about those questions, we can work to address those. In the meantime, hope the other stuff works well for you!