class Aws::Plugins::RecursionDetection::Handler

@api private

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-core/plugins/recursion_detection.rb, line 10
def call(context)

  unless context.http_request.headers.key?('x-amzn-trace-id')
    if ENV['AWS_LAMBDA_FUNCTION_NAME'] &&
      (trace_id = validate_header(ENV['_X_AMZN_TRACE_ID']))
      context.http_request.headers['x-amzn-trace-id'] = trace_id
    end
  end
  @handler.call(context)
end

Private Instance Methods

validate_header(header_value) click to toggle source
# File lib/aws-sdk-core/plugins/recursion_detection.rb, line 22
def validate_header(header_value)
  return unless header_value

  if (header_value.chars & (0..31).map(&:chr)).any?
    raise ArgumentError, 'Invalid _X_AMZN_TRACE_ID value: '\
      'contains ASCII control characters'
  end
  header_value
end