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-4.1.0.333 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-4.0.0.332 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.18.1.330 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.18.0.329 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.17.2.327 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.17.1.326 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.17.0.325 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.16.3.323 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.16.2.321 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.16.1.320 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.16.0.318 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.15.2.317 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.15.1.316 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.15.0.314 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.14.3.313 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.14.2.312 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.14.1.311 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.14.0.305 test/multiverse/suites/rack/rack_parameter_filtering_test.rb
newrelic_rpm-3.13.2.302 test/multiverse/suites/rack/rack_parameter_filtering_test.rb