httplog 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,12 +27,17 @@ module Net
27
27
 
28
28
  def request(req, body = nil, &block)
29
29
 
30
- if HttpLog.options[:log_request]
31
- HttpLog::log("Sending: #{req.method} http://#{@address}:#{@port}#{req.path}")
32
- end
33
-
34
- if req.request_body_permitted? && HttpLog.options[:log_data]
35
- HttpLog::log("Data: #{body}")
30
+ if started?
31
+ if HttpLog.options[:log_request]
32
+ HttpLog::log("Sending: #{req.method} http://#{@address}:#{@port}#{req.path}")
33
+ end
34
+
35
+ if req.method == "POST" && HttpLog.options[:log_data]
36
+ # a bit convoluted becase post_form uses form_data= to assign the data, so
37
+ # in that case req.body will be empty
38
+ data = req.body.nil? || req.body.size == 0 ? body : req.body
39
+ HttpLog::log("Data: #{data}")
40
+ end
36
41
  end
37
42
 
38
43
  orig_request(req, body, &block)
@@ -1,3 +1,3 @@
1
1
  module HttpLog
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: httplog
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thilo Rusche
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- hash: -1001317091
59
+ hash: -55724721
60
60
  segments:
61
61
  - 0
62
62
  version: "0"