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.
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.5
4
+
5
+ * fix downstream custom response bodies
6
+
3
7
  ## 0.0.4
4
8
 
5
9
  * remove faye adapter ca5a2e493dedf0a91b1ccb0827be195ef9cfd269
@@ -89,15 +89,8 @@ module Rack
89
89
  @handler = Handlers.find(self)
90
90
  @status, @headers, app_body = @app.call(@env)
91
91
 
92
- app_body = if app_body.respond_to?(:body_parts)
93
- app_body.body_parts
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!
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rack-stream"
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Jerry Cheung"]
8
8
  s.email = ["jerry@intridea.com"]
@@ -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
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-05-25 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack