Sha256: a8fecd8cd7b9e94449c2b1615e892ddf365096e8b974c5fd3f975a4b5ad8d6e7

Contents?: true

Size: 1.82 KB

Versions: 8

Compression:

Stored size: 1.82 KB

Contents

# encoding: utf-8

require "logstash/devutils/rspec/spec_helper"
require "logstash/filters/urldecode"

describe LogStash::Filters::Urldecode do
  describe "urldecode of correct urlencoded data" do
    # The logstash config goes here.
    # At this time, only filters are supported.
    config <<-CONFIG
      filter {
        urldecode {
        }
      }
    CONFIG

    sample("message" => "http%3A%2F%2Flogstash.net%2Fdocs%2F1.3.2%2Ffilters%2Furldecode") do
      insist { subject["message"] } == "http://logstash.net/docs/1.3.2/filters/urldecode"
    end
  end

  describe "urldecode of incorrect urlencoded data" do
    config <<-CONFIG
      filter {
        urldecode {
        }
      }
    CONFIG

    sample("message" => "http://logstash.net/docs/1.3.2/filters/urldecode") do
      insist { subject["message"] } == "http://logstash.net/docs/1.3.2/filters/urldecode"
    end
  end

   describe "urldecode with all_fields set to true" do
    # The logstash config goes here.
    # At this time, only filters are supported.
    config <<-CONFIG
      filter {
        urldecode {
          all_fields => true
        }
      }
    CONFIG

    sample("message" => "http%3A%2F%2Flogstash.net%2Fdocs%2F1.3.2%2Ffilters%2Furldecode", "nonencoded" => "http://logstash.net/docs/1.3.2/filters/urldecode") do
      insist { subject["message"] } == "http://logstash.net/docs/1.3.2/filters/urldecode"
      insist { subject["nonencoded"] } == "http://logstash.net/docs/1.3.2/filters/urldecode"
    end
  end

   describe "urldecode should replace invalid UTF-8" do
     config <<-CONFIG
      filter {
        urldecode {}
      }
     CONFIG
     sample("message" => "/a/sa/search?rgu=0;+%C3%BB%D3%D0%D5%D2%B5%BD=;+%B7%A2%CB%CD=") do
      insist { subject["message"] } == "/a/sa/search?rgu=0;+û\\xD3\\xD0\\xD5ҵ\\xBD=;+\\xB7\\xA2\\xCB\\xCD="
     end
   end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
logstash-filter-urldecode-2.0.4 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-2.0.2 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-2.0.1 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-2.0.0 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-1.0.0 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-0.1.5 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-0.1.4 spec/filters/urldecode_spec.rb
logstash-filter-urldecode-0.1.3 spec/filters/urldecode_spec.rb