Class: Contrast::Agent::Assess::Policy::Propagator::Response

Inherits:
Base
  • Object
show all
Defined in:
lib/contrast/agent/assess/policy/propagator/response.rb

Overview

Propagation that results in all the tags of the source being applied to the target at the point of insertion. The target’s preexisting tags are shifted to account for this insertion.

Class Method Summary collapse

Methods inherited from Base

find_source, propagate, tracked_value?

Class Method Details

.net_response_keep(propagation_node, preshift, ret, _block) ⇒ Object

This will path the Net::HTTP.request method. It takes two parameters:

- req: Net::HTTPGenericRequest
- body: String

As body may be optional, we need to check if it’s nil or not.

Parameters:



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/contrast/agent/assess/policy/propagator/response.rb', line 26

def net_response_keep propagation_node, preshift, ret, _block
  return unless Contrast::ASSESS.track_response_as_source?

  # Check to see if the argument is of correct type, and whether the body is tracked or not.
  # if it's tracked and the body is not nil, then copy the properties from the source's body
  # to the target's body.
  source_body = if preshift.args.length == 2
                  preshift.args[1]
                else
                  preshift.args[0]&.body
                end
  copy_body_tags(propagation_node, source_body, ret)
end