request_visualizer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/request_visualizer/version.rb +1 -1
- data/lib/request_visualizer.rb +7 -3
- metadata +4 -4
data/lib/request_visualizer.rb
CHANGED
@@ -26,10 +26,14 @@ class RequestVisualizer
|
|
26
26
|
puts "#{self.indent}#{from} -> #{request.request_method.upcase.bold} (#{request.url.underline}) -> #{to}"
|
27
27
|
request.body.rewind
|
28
28
|
req_body = request.body.read
|
29
|
+
indent_prefix = self.indent
|
29
30
|
begin
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
if request.env["CONTENT_TYPE"].to_s.include?("form-urlencoded")
|
32
|
+
puts indent_prefix + CGI.parse(req_body).pretty_inspect.gsub("\n","\n#{indent_prefix}")
|
33
|
+
else
|
34
|
+
json = JSON.parse(req_body)
|
35
|
+
puts indent_prefix + json.pretty_inspect.gsub("\n","\n#{indent_prefix}")
|
36
|
+
end
|
33
37
|
rescue => e
|
34
38
|
# puts "WARN: JSON request with non-json body! (#{req_body})"
|
35
39
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: request_visualizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jacob Burkhart
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-06-19 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: colored
|