rack-stream 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/lib/rack/stream/app.rb +2 -9
- data/rack-stream.gemspec +1 -1
- data/spec/lib/rack/stream_spec.rb +19 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/lib/rack/stream/app.rb
CHANGED
@@ -89,15 +89,8 @@ module Rack
|
|
89
89
|
@handler = Handlers.find(self)
|
90
90
|
@status, @headers, app_body = @app.call(@env)
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
elsif app_body.respond_to?(:body)
|
95
|
-
app_body.body
|
96
|
-
else
|
97
|
-
app_body
|
98
|
-
end
|
99
|
-
|
100
|
-
chunk(*app_body) # chunk any downstream response bodies
|
92
|
+
# chunk any downstream response bodies
|
93
|
+
app_body.each {|body| chunk(body)}
|
101
94
|
after_open {close} if @callbacks[:after_open].empty?
|
102
95
|
|
103
96
|
@handler.open!
|
data/rack-stream.gemspec
CHANGED
@@ -58,6 +58,25 @@ describe Rack::Stream do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
context "custom response body" do
|
62
|
+
let(:endpoint) {
|
63
|
+
lambda {|env|
|
64
|
+
response_klass = Class.new {
|
65
|
+
def each
|
66
|
+
%w(Chunky Monkey).each do |body|
|
67
|
+
yield body
|
68
|
+
end
|
69
|
+
end
|
70
|
+
}
|
71
|
+
[200, {}, response_klass.new]
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
it 'should chunk downstream custom response bodies' do
|
76
|
+
last_response.body.should == "6\r\nChunky\r\n6\r\nMonkey\r\n0\r\n\r\n"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
61
80
|
context "synchrony" do
|
62
81
|
let(:endpoint) {
|
63
82
|
lambda {|env|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|