Skip to content

feat: Expand version support for http.rb v6#82

Merged
keelerm84 merged 6 commits intomainfrom
mk/sdk-2060/support-httpv6
Mar 25, 2026
Merged

feat: Expand version support for http.rb v6#82
keelerm84 merged 6 commits intomainfrom
mk/sdk-2060/support-httpv6

Conversation

@keelerm84
Copy link
Member

@keelerm84 keelerm84 commented Mar 24, 2026

This commit adds support for http.rb v6 while maintaining backward
compatibility with v4 and v5. The http.rb v6 release changed from
accepting an options hash to requiring keyword arguments for the
HTTP::Client constructor and related methods.

Key changes:

  • Update gemspec to allow http.rb versions up to 7.0.0
  • Add VALID_HTTP_CLIENT_OPTIONS constant to filter options passed to
    HTTP::Client, preventing errors from unsupported options
  • Convert all HTTP client option keys from strings to symbols
  • Update HTTP::Client initialization and method calls to use keyword
    arguments (**options) instead of hash arguments
  • Add EOFError handling for improved connection cleanup in v6
  • Add comprehensive test coverage for options filtering

The filtering mechanism ensures that only valid HTTP client options
are passed through, which is particularly important for maintaining
backward compatibility when custom http_client_options are provided.


Note

Medium Risk
Moderate risk because it changes how HTTP::Client is constructed and invoked (hash -> keyword args) and alters option handling, which could affect connection/proxy/timeout behavior across http.rb versions.

Overview
Adds support for http gem v6 (while keeping v4/v5 compatibility) by allowing versions < 7.0.0, switching HTTP::Client.new and request calls to keyword arguments, and normalizing timeouts to floats.

Introduces a VALID_HTTP_CLIENT_OPTIONS allowlist that symbol-izes and filters http_client_options (warning on ignored keys), applies timeouts only when set, and treats EOFError during streaming reads as a clean disconnect.

Extends specs with new coverage to ensure option filtering works for string/symbol keys, ignores unknown options without raising, and preserves known options.

Written by Cursor Bugbot for commit 00aa2b0. This will update automatically on new commits. Configure here.

This commit adds support for http.rb v6 while maintaining backward
compatibility with v4 and v5. The http.rb v6 release changed from
accepting an options hash to requiring keyword arguments for the
HTTP::Client constructor and related methods.

Key changes:
- Update gemspec to allow http.rb versions up to 7.0.0
- Add VALID_HTTP_CLIENT_OPTIONS constant to filter options passed to
  HTTP::Client, preventing errors from unsupported options
- Convert all HTTP client option keys from strings to symbols
- Update HTTP::Client initialization and method calls to use keyword
  arguments (**options) instead of hash arguments
- Add EOFError handling for improved connection cleanup in v6
- Add comprehensive test coverage for options filtering

The filtering mechanism ensures that only valid HTTP client options
are passed through, which is particularly important for maintaining
backward compatibility when custom http_client_options are provided.
@keelerm84 keelerm84 requested a review from a team as a code owner March 24, 2026 19:33
# TODO(breaking): Remove this filtering once we have updated to the next major breaking version.
# HTTP v6 requires keyword arguments instead of an options hash, so we filter to only known valid
# arguments to avoid passing unsupported options.
VALID_HTTP_CLIENT_OPTIONS = %i[
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsonbailey here is the approach we were discussing.

The only issue I found was that v4 and v5 support cookies as a parameter, but v6 dropped that. I don't include cookies in the list of allowable options since it would hard break in v6. However, I do log whenever we drop an option. Maybe that's a sufficient middle ground?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@keelerm84 keelerm84 merged commit 2f8732a into main Mar 25, 2026
10 checks passed
@keelerm84 keelerm84 deleted the mk/sdk-2060/support-httpv6 branch March 25, 2026 18:37
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.

2 participants