class Sniffer::DataItem::Response
Stores http response data
Attributes
body[RW]
headers[RW]
status[RW]
timing[RW]
Public Instance Methods
to_h()
click to toggle source
# File lib/sniffer/data_item.rb, line 111 def to_h { status: status, headers: headers, body: # frozen_string_literal: true # Sniffer data item stores a request info # Basic object for request and response objects # Stores http request data # rubocop:enable # Stores http response data body&.to_s, timing: timing } end
to_log()
click to toggle source
rubocop:disable Metrics/AbcSize
# File lib/sniffer/data_item.rb, line 128 def to_log {}.tap do |hash| hash[:status] = status if log_settings["response_status"] if log_settings["response_headers"] headers.each do |(k, v)| hash[:"rs_#{k.to_s.tr("-", '_').downcase}"] = v end end hash[:timing] = timing if log_settings["timing"] hash[:response_body] = body.to_s if log_settings["response_body"] end end