lib/lvs/json_service/request.rb in LVS-JSONService-0.2.4 vs lib/lvs/json_service/request.rb in LVS-JSONService-0.2.5
- old
+ new
@@ -14,12 +14,10 @@
def http_request_with_timeout(service, args, options)
uri = URI.parse(service)
http = Net::HTTP.new(uri.host, uri.port)
-
- http = Net::HTTP.new(uri.host, uri.port)
if options[:encrypted] || require_ssl?
http.use_ssl = true
# Self-signed certs give streams of "warning: peer certificate won't be verified in this SSL session"
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
LVS::JsonService::Logger.debug "Using SSL"
@@ -90,10 +88,10 @@
response = http_request_with_timeout(service, args, options)
result = JSON.parse(response.body)
timing = ("%.1f" % ((Time.now - start) * 1000)) + "ms"
end
- if response.body.size < 1024
+ if response.body.size < 1024 || options[:debug]
LVS::JsonService::Logger.debug "Response (#{timing}): #{response.body.gsub(/\n/, '')}"
else
LVS::JsonService::Logger.debug "Response Snippet (#{timing}): #{response.body.gsub(/\n/, '')[0..1024]}"
end
if result.is_a?(Hash) && result.has_key?("PCode")