Class: AppMap::Handler::Rails::RequestHandler::HTTPServerResponse
- Inherits:
 - 
      Event::MethodReturn
      
        
- Object
 - Struct
 - Event::MethodEventStruct
 - Event::MethodEvent
 - Event::MethodReturnIgnoreValue
 - Event::MethodReturn
 - AppMap::Handler::Rails::RequestHandler::HTTPServerResponse
 
 
- Defined in:
 - lib/appmap/handler/rails/request_handler.rb
 
Constant Summary
Constants inherited from Event::MethodEvent
Event::MethodEvent::MAX_ARRAY_ENUMERATION, Event::MethodEvent::MAX_HASH_ENUMERATION, Event::MethodEvent::MAX_STRING_LENGTH
Constants included from ValueInspector
ValueInspector::MAX_ARRAY_ELEMENTS, ValueInspector::MAX_DEPTH
Instance Attribute Summary collapse
- 
  
    
      #headers  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute headers.
 - 
  
    
      #status  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute status.
 
Attributes inherited from Event::MethodReturn
Attributes inherited from Event::MethodReturnIgnoreValue
#elapsed, #elapsed_instrumentation, #parent_id
Attributes inherited from Event::MethodEventStruct
Class Method Summary collapse
- .build_from_invocation(parent_id, return_value, elapsed, response, event: HTTPServerResponse.new) ⇒ Object
 - .valid_http_status?(status) ⇒ Boolean
 
Instance Method Summary collapse
Methods inherited from Event::MethodEvent
add_schema, add_size, custom_display_string, default_display_string, display_string, encode_display_string, #ready?
Methods included from ValueInspector
#best_class_name, #detect_schema, #detect_size
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
      79 80 81  | 
    
      # File 'lib/appmap/handler/rails/request_handler.rb', line 79 def headers @headers end  | 
  
#status ⇒ Object
Returns the value of attribute status.
      79 80 81  | 
    
      # File 'lib/appmap/handler/rails/request_handler.rb', line 79 def status @status end  | 
  
Class Method Details
.build_from_invocation(parent_id, return_value, elapsed, response, event: HTTPServerResponse.new) ⇒ Object
      82 83 84 85 86 87 88 89  | 
    
      # File 'lib/appmap/handler/rails/request_handler.rb', line 82 def build_from_invocation(parent_id, return_value, elapsed, response, event: HTTPServerResponse.new) event ||= HTTPServerResponse.new status = response[:status] || response.status event.status = status if valid_http_status?(status) event.headers = (response[:headers] || response.headers).dup AppMap::Event::MethodReturn.build_from_invocation parent_id, return_value, nil, elapsed: elapsed, event: event, parameter_schema: true end  | 
  
.valid_http_status?(status) ⇒ Boolean
      92 93 94  | 
    
      # File 'lib/appmap/handler/rails/request_handler.rb', line 92 def self.valid_http_status?(status) status.is_a?(Integer) && status >= 100 && status < 600 end  | 
  
Instance Method Details
#to_h ⇒ Object
      96 97 98 99 100 101 102 103  | 
    
      # File 'lib/appmap/handler/rails/request_handler.rb', line 96 def to_h super.tap do |h| h[:http_server_response] = { status_code: status, headers: headers }.compact end end  |