Sha256: 7aedc329b86e0340049bec8e480ba901be2988dc9fb0dabd831f17c2fa39ef09

Contents?: true

Size: 1.34 KB

Versions: 24

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'filtering_test_app'

if NewRelic::Agent::Instrumentation::RackHelpers.rack_version_supported?

  class RackParameterFilteringTest < Minitest::Test
    include MultiverseHelpers

    setup_and_teardown_agent

    include Rack::Test::Methods

    def app
      Rack::Builder.app { run FilteringTestApp.new }
    end

    def test_file_upload_params_are_filtered
      with_config(:capture_params => true) do
        params = {
          :title => "blah",
          :file => Rack::Test::UploadedFile.new(__FILE__, 'text/plain')
        }
        post '/', params

        expected = {
          "request.parameters.title" => "blah",
          "request.parameters.file" => "[FILE]"
        }
        assert_equal expected, last_transaction_trace_request_params
      end
    end

    def test_apply_filters_returns_params_when_rails_is_not_present
      with_config(:capture_params => true) do
        params = {"name" => "name", "password" => "mypass"}
        post '/', params

        expected = {
          "request.parameters.name" => "name",
          "request.parameters.password" => "mypass"
        }
        assert_equal expected, last_transaction_trace_request_params
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
newrelic_rpm-3.13.1.300 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.13.0.299 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.12.1.298 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.12.0.288 test/multiverse/suites/rack/rack_parameter_filtering_test.rb