The stream argument must implement `#<<`. (#1959)

This commit is contained in:
Samuel Williams 2022-08-31 14:31:46 +12:00 committed by GitHub
parent ffee3c5528
commit 6aad539040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -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 supplied to the streaming body and hijack must support `#<<` for writing output.
### Removed
@ -44,6 +45,7 @@ All notable changes to this project will be documented in this file. For info on
- Support callable body for explicit streaming support and clarify streaming response body behaviour. ([#1745](https://github.com/rack/rack/pull/1745), [@ioquatix], [#1748](https://github.com/rack/rack/pull/1748), [@wjordan])
- Allow `Rack::Builder#run` to take a block instead of an argument. ([#1942](https://github.com/rack/rack/pull/1942), [@ioquatix])
- Add `rack.response_finished` to `Rack::Lint`. ([#1802](https://github.com/rack/rack/pull/1802), [@BlakeWilliams], [#1952](https://github.com/rack/rack/pull/1952), [@ioquatix])
- The stream argument must implement `#<<`. ([#1959](https://github.com/rack/rack/pull/1959), [@ioquatix])
### Changed

View File

@ -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

View File

@ -861,7 +861,7 @@ module Rack
## 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
@ -875,7 +875,7 @@ module Rack
## 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?
]