Class: RestClient::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/morpheus/ext/rest_client.rb

Instance Method Summary collapse

Instance Method Details

#log_requestObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/morpheus/ext/rest_client.rb', line 9

def log_request
  begin
    return unless RestClient.log
    out = []
    # out << "RestClient.#{method} #{redacted_url.inspect}"
    out << "#{method.to_s.upcase} #{redacted_url.inspect}"
    out << payload.short_inspect if payload
    out << processed_headers.to_a.sort.map { |(k, v)| [k.inspect, v.inspect].join("=>") }.join(", ")
    RestClient.log << out.join(', ') + "\n"
  rescue
    # something went wrong, wrong gem version maybe...above is from rest-client 2.0.2
    # do it the old way
    original_log_request()
  end
end

#original_log_requestObject



8
# File 'lib/morpheus/ext/rest_client.rb', line 8

alias_method :original_log_request, :log_request