rack-profiler 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/profiler.rb +8 -2
- data/lib/rack/profiler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f67856e0027806b21c8fa11c400055049be97e5f
|
4
|
+
data.tar.gz: 50a680263ec4263e64cf53f63ff991bed6d6bd8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|