You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SPEC.rdoc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,7 +140,7 @@ The error stream. See the section below on the error stream for more information
140
140
141
141
==== <tt>rack.response_finished</tt>
142
142
143
-
If present, an array of callables that will be run by the server after the response has been processed. The callables are called with <tt>environment, status, headers, error</tt> arguments and should not raise any exceptions. The callables would typically be called after sending the response to the client, but it could also be called if an error occurs while generating the response or sending the response (in that case, the +error+ argument will be a kind of +Exception+). The callables will be invoked in reverse order.
143
+
If present, an array of callables that will be run by the server after the response has been processed. The callables are called with <tt>environment, status, headers, error</tt> arguments and should not raise any exceptions. The callables would typically be called after sending the response to the client, but it could also be called if an error occurs while generating the response or sending the response (in that case, the +error+ argument will be a kind of +Exception+). The callables will be called in reverse order.
144
144
145
145
=== The Input Stream
146
146
@@ -181,7 +181,7 @@ Partial hijack is used for bi-directional streaming of the request and response
181
181
182
182
If <tt>rack.hijack?</tt> is present in +env+ and truthy, an application may set the special response header <tt>rack.hijack</tt> to an object that responds to +call+, accepting a +stream+ argument.
183
183
184
-
After the response status and headers have been sent, this hijack callback will be invoked with a +stream+ argument which follows the same interface as outlined in "Streaming Body". Servers must ignore the +body+ part of the response tuple when the <tt>rack.hijack</tt> response header is present. Using an empty +Array+ is recommended.
184
+
After the response status and headers have been sent, this hijack callback will be called with a +stream+ argument which follows the same interface as outlined in "Streaming Body". Servers must ignore the +body+ part of the response tuple when the <tt>rack.hijack</tt> response header is present. Using an empty +Array+ is recommended.
185
185
186
186
The special response header <tt>rack.hijack</tt> must only be set if the request +env+ has a truthy <tt>rack.hijack?</tt>.
187
187
@@ -239,15 +239,15 @@ If the Body responds to +to_path+, it must return either +nil+ or a +String+. If
239
239
240
240
==== Enumerable Body
241
241
242
-
The Enumerable Body must respond to +each+. It must only be called once. It must not be called after being closed, and must only yield +String+ values.
242
+
The Enumerable Body must respond to +each+. It must only be consumed once (calling this method consumes the body). It must not be called after being closed, and must only yield +String+ values.
243
243
244
244
Middleware must not call +each+ directly on the Body. Instead, middleware can return a new Body that calls +each+ on the original Body, yielding at least once per iteration.
245
245
246
246
If the Body responds to +to_ary+, it must return an +Array+ whose contents are identical to that produced by calling +each+. Middleware may call +to_ary+ directly on the Body and return a new Body in its place. In other words, middleware can only process the Body directly if it responds to +to_ary+. If the Body responds to both +to_ary+ and +close+, its implementation of +to_ary+ must call +close+.
247
247
248
248
==== Streaming Body
249
249
250
-
The Streaming Body must respond to +call+. It must only be called once. It must not be called after being closed. It takes a +stream+ argument.
250
+
The Streaming Body must respond to +call+. It must only be consumed once (calling this method consumes the body). It must not be called after being closed. It takes a +stream+ argument.
251
251
252
252
The +stream+ argument must respond to: +read+, +write+, <tt><<</tt>, +flush+, +close+, +close_read+, +close_write+, and +closed?+. 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 and raising standard exceptions. Servers may simply pass on real +IO+ objects to the Streaming Body. In some cases (e.g. when using <tt>transfer-encoding</tt> or <tt>HTTP/2+</tt>), the server may need to provide a wrapper that implements the required methods, in order to provide the correct semantics.
Copy file name to clipboardExpand all lines: lib/rack/lint.rb
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ def initialize(app, env)
82
82
@status=nil
83
83
@headers=nil
84
84
@body=nil
85
-
@invoked=nil
85
+
@consumed=nil
86
86
@content_length=nil
87
87
@closed=false
88
88
@size=0
@@ -467,7 +467,7 @@ def check_environment(env)
467
467
##
468
468
## ==== <tt>rack.response_finished</tt>
469
469
##
470
-
## If present, an array of callables that will be run by the server after the response has been processed. The callables are called with <tt>environment, status, headers, error</tt> arguments and should not raise any exceptions. The callables would typically be called after sending the response to the client, but it could also be called if an error occurs while generating the response or sending the response (in that case, the +error+ argument will be a kind of +Exception+). The callables will be invoked in reverse order.
470
+
## If present, an array of callables that will be run by the server after the response has been processed. The callables are called with <tt>environment, status, headers, error</tt> arguments and should not raise any exceptions. The callables would typically be called after sending the response to the client, but it could also be called if an error occurs while generating the response or sending the response (in that case, the +error+ argument will be a kind of +Exception+). The callables will be called in reverse order.
## After the response status and headers have been sent, this hijack callback will be invoked with a +stream+ argument which follows the same interface as outlined in "Streaming Body". Servers must ignore the +body+ part of the response tuple when the <tt>rack.hijack</tt> response header is present. Using an empty +Array+ is recommended.
659
+
## After the response status and headers have been sent, this hijack callback will be called with a +stream+ argument which follows the same interface as outlined in "Streaming Body". Servers must ignore the +body+ part of the response tuple when the <tt>rack.hijack</tt> response header is present. Using an empty +Array+ is recommended.
660
660
else
661
661
##
662
662
## The special response header <tt>rack.hijack</tt> must only be set if the request +env+ has a truthy <tt>rack.hijack?</tt>.
@@ -858,13 +858,13 @@ def each
858
858
## The Enumerable Body must respond to +each+. \
859
859
raiseLintError,"Enumerable Body must respond to each"unless@body.respond_to?(:each)
860
860
861
-
## It must only be called once. \
862
-
raiseLintError,"Response body must only be invoked once (#{@invoked})"unless@invoked.nil?
861
+
## It must only be consumed once (calling this method consumes the body). \
862
+
raiseLintError,"Response body must only be consumed once (#{@consumed})"unless@consumed.nil?
863
863
864
864
## It must not be called after being closed, \
865
865
raiseLintError,"Response body is already closed"if@closed
866
866
867
-
@invoked=:each
867
+
@consumed=:each
868
868
869
869
@body.eachdo |chunk|
870
870
## and must only yield +String+ values.
@@ -924,13 +924,13 @@ def call(stream)
924
924
## The Streaming Body must respond to +call+. \
925
925
raiseLintError,"Streaming Body must respond to call"unless@body.respond_to?(:call)
926
926
927
-
## It must only be called once. \
928
-
raiseLintError,"Response body must only be invoked once (#{@invoked})"unless@invoked.nil?
927
+
## It must only be consumed once (calling this method consumes the body). \
928
+
raiseLintError,"Response body must only be consumed once (#{@consumed})"unless@consumed.nil?
929
929
930
930
## It must not be called after being closed. \
931
931
raiseLintError,"Response body is already closed"if@closed
0 commit comments