Class: AppMap::Handler::NetHTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/appmap/handler/net_http.rb

Class Method Summary collapse

Class Method Details

.copy_headers(obj) ⇒ Object



86
87
88
89
90
91
92
93
# File 'lib/appmap/handler/net_http.rb', line 86

def copy_headers(obj)
  {}.tap do |headers|
    obj.each_header do |key, value|
      key = key.split('-').map(&:capitalize).join('-')
      headers[key] = value
    end
  end
end

.handle_call(defined_class, hook_method, receiver, args) ⇒ Object



95
96
97
98
99
100
101
102
# File 'lib/appmap/handler/net_http.rb', line 95

def handle_call(defined_class, hook_method, receiver, args)
  # request will call itself again in a start block if it's not already started.
  return unless receiver.started?

  http = receiver
  request = args.first
  HTTPClientRequest.new(http, request)
end

.handle_return(call_event_id, elapsed, return_value, exception) ⇒ Object



104
105
106
# File 'lib/appmap/handler/net_http.rb', line 104

def handle_return(call_event_id, elapsed, return_value, exception)
  HTTPClientResponse.new(return_value, call_event_id, elapsed)
end