Class: AppMap::Handler::Rails::RequestHandler::HTTPServerResponse

Inherits:
Event::MethodReturnIgnoreValue show all
Defined in:
lib/appmap/handler/rails/request_handler.rb

Constant Summary

Constants inherited from Event::MethodEvent

Event::MethodEvent::LIMIT

Instance Attribute Summary collapse

Attributes inherited from Event::MethodReturnIgnoreValue

#elapsed, #parent_id

Attributes inherited from Event::MethodEventStruct

#event, #id, #thread_id

Instance Method Summary collapse

Methods inherited from Event::MethodReturnIgnoreValue

build_from_invocation

Methods inherited from Event::MethodEvent

best_class_name, build_from_invocation, custom_display_string, default_display_string, display_string, object_properties

Constructor Details

#initialize(response, parent_id, elapsed) ⇒ HTTPServerResponse

Returns a new instance of HTTPServerResponse.



76
77
78
79
80
81
82
83
84
# File 'lib/appmap/handler/rails/request_handler.rb', line 76

def initialize(response, parent_id, elapsed)
  super AppMap::Event.next_id_counter, :return, Thread.current.object_id

  self.status = response.status
  self.mime_type = response.headers['Content-Type']
  self.parent_id = parent_id
  self.elapsed = elapsed
  self.headers = AppMap::Util.select_headers(response.headers)
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



74
75
76
# File 'lib/appmap/handler/rails/request_handler.rb', line 74

def headers
  @headers
end

#mime_typeObject

Returns the value of attribute mime_type.



74
75
76
# File 'lib/appmap/handler/rails/request_handler.rb', line 74

def mime_type
  @mime_type
end

#statusObject

Returns the value of attribute status.



74
75
76
# File 'lib/appmap/handler/rails/request_handler.rb', line 74

def status
  @status
end

Instance Method Details

#to_hObject



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

def to_h
  super.tap do |h|
    h[:http_server_response] = {
      status_code: status,
      mime_type: mime_type,
      headers: headers
    }.compact
  end
end