mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
parent
ae450f9b66
commit
ffa9c710a2
2 changed files with 25 additions and 0 deletions
|
@ -47,5 +47,10 @@ class LogStash::Util::SafeURI
|
||||||
def ==(other)
|
def ==(other)
|
||||||
other.is_a?(::LogStash::Util::SafeURI) ? @uri == other.uri : false
|
other.is_a?(::LogStash::Util::SafeURI) ? @uri == other.uri : false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clone
|
||||||
|
cloned_uri = uri.clone
|
||||||
|
self.class.new(cloned_uri)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
20
logstash-core/spec/logstash/util/safe_uri_spec.rb
Normal file
20
logstash-core/spec/logstash/util/safe_uri_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
require "logstash/util/safe_uri"
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
module LogStash module Util
|
||||||
|
describe SafeURI do
|
||||||
|
describe "#clone" do
|
||||||
|
subject { LogStash::Util::SafeURI.new("http://localhost:9200/uri?q=s") }
|
||||||
|
it "allows modifying uri parameters" do
|
||||||
|
cloned_safe_uri = subject.clone
|
||||||
|
cloned_safe_uri.path = "/cloned"
|
||||||
|
cloned_safe_uri.query = "a=b"
|
||||||
|
expect(subject.path).to eq("/uri")
|
||||||
|
expect(subject.query).to eq("q=s")
|
||||||
|
expect(cloned_safe_uri.path).to eq("/cloned")
|
||||||
|
expect(cloned_safe_uri.query).to eq("a=b")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end end
|
Loading…
Add table
Add a link
Reference in a new issue