request_visualizer 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.
@@ -1,3 +1,3 @@
1
1
  class RequestVisualizer
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
- json = JSON.parse(req_body)
31
- indent_prefix = self.indent
32
- puts indent_prefix + json.pretty_inspect.gsub("\n","\n#{indent_prefix}")
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
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-03-16 00:00:00 Z
18
+ date: 2012-06-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: colored