Skip to content

Preserve streaming response destinations with body encoding - #338

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/streaming-destination-encoding
Open

Preserve streaming response destinations with body encoding#338
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/streaming-destination-encoding

Conversation

@OskarEichler

Copy link
Copy Markdown

Net::HTTPResponse#read_body supports an IO-like destination, but configured response body encoding currently assumes that destination is a String and calls String-only encoding methods after streaming completes. This raises for valid streaming destinations. Only run encoding detection or forcing when the destination responds to force_encoding. String bodies retain existing behavior and IO-like destinations keep the bytes already streamed. The unchanged current suite passes 201 tests / 914 assertions on Ruby 4.0.6 and 199 / 906 on Ruby 3.2.11. External dual-Ruby behavior models, syntax and diff checks pass. No repository tests were changed.

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