rack-profiler 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 021d440e7dbfacd1c14ce5b84d7c7f06b7c9ad6b
4
- data.tar.gz: eee4e4669a2d071a2bde2e6875237423a21dd5d9
3
+ metadata.gz: f67856e0027806b21c8fa11c400055049be97e5f
4
+ data.tar.gz: 50a680263ec4263e64cf53f63ff991bed6d6bd8e
5
5
  SHA512:
6
- metadata.gz: d2186dacc2aaad4cda88c18534f488e55ac3472784787b4ad6aed9e6ae1f1c6deeae2f7c7ff61d969b0ed236ad322766382ffb48802c9f281969b48de26f7775
7
- data.tar.gz: de9bec1458fb10a654ad7cfd1088b427d043104e05d9d1cd077201df7025a1d7459bd95fc814df5e2b6c3fadcff56e83fc70a14c2b56759e21552797bfc04ea5
6
+ metadata.gz: 8df8668240edd5c83482b5f9c67efd68c191af79fc279eb6f704af00139ad98a1b219f4cfa8c481ec557b6761be64f8891d1b09cdb754a1833fa442653c03875
7
+ data.tar.gz: 18c2d0048b5bc978d7937ca24b8d727ef2b815f00e1a097cbfca81538c33ecf5ef799ef86435e0728ab828fe41a6c61c3e5f9a1a8c58a69a375c7540eaf1910d
data/lib/rack/profiler.rb CHANGED
@@ -73,8 +73,7 @@ module Rack
73
73
  Profiler.step('total_time') do
74
74
  status, headers, body = @app.call(env)
75
75
  end
76
- body.close if body.respond_to?(:close)
77
- [200, { 'Content-Type' => 'application/json' }, [{ events: nested_events, response: { status: status, headers: headers, body: body } }.to_json]]
76
+ [200, { 'Content-Type' => 'application/json' }, [{ events: nested_events, response: { status: status, headers: headers, body: stringify_body(body) } }.to_json]]
78
77
  else
79
78
  @status, @headers, @body = @app.call(env)
80
79
  end
@@ -135,5 +134,12 @@ module Rack
135
134
  backtrace.select(&self.class.backtrace_filter)
136
135
  end
137
136
  end
137
+
138
+ def stringify_body(body)
139
+ body.close if body.respond_to?(:close)
140
+ str = ""
141
+ body.each {|part| str << part }
142
+ str
143
+ end
138
144
  end
139
145
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Profiler
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Ongaro