Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The stream argument must implement #<<. #1959

Merged
merged 3 commits into from Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. For info on
- `rack.hijack_io` has been removed completely.
- `rack.response_finished` is an optional environment key which contains an array of callable objects that must accept `#call(env, status, headers, error)` and are invoked after the response is finished (either successfully or unsucessfully).
- It is okay to call `#close` on `rack.input` to indicate that you no longer need or care about the input.
- The stream argument to streaming responses and hijack must support `#<<` for writing output.

### Removed

Expand Down
2 changes: 1 addition & 1 deletion SPEC.rdoc
Expand Up @@ -327,7 +327,7 @@ It must not be called after being closed.
It takes a +stream+ argument.

The +stream+ argument must implement:
<tt>read, write, flush, close, close_read, close_write, closed?</tt>
<tt>read, write, <<, flush, close, close_read, close_write, closed?</tt>

The semantics of these IO methods must be a best effort match to
those of a normal Ruby IO or Socket object, using standard arguments
Expand Down
4 changes: 2 additions & 2 deletions lib/rack/lint.rb
Expand Up @@ -861,7 +861,7 @@ def call(stream)
## It takes a +stream+ argument.
##
## The +stream+ argument must implement:
## <tt>read, write, flush, close, close_read, close_write, closed?</tt>
## <tt>read, write, <<, flush, close, close_read, close_write, closed?</tt>
##
@body.call(StreamWrapper.new(stream))
end
Expand All @@ -875,7 +875,7 @@ class StreamWrapper
## pass on real IO objects, although it is recognized that this approach
## is not directly compatible with HTTP/2.
REQUIRED_METHODS = [
:read, :write, :flush, :close,
:read, :write, :<<, :flush, :close,
:close_read, :close_write, :closed?
]

Expand Down