Skip to content

Commit f31bdcb

Browse files
author
Daniel Magliola
committed
Remove call to deprecated URI.escape
This method has been deprecated for a while, and it gives us warnings in Ruby 2.7 Signed-off-by: Daniel Magliola <[email protected]>
1 parent c80c550 commit f31bdcb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/prometheus/client/push.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def parse(url)
6666

6767
def build_path(job, instance)
6868
if instance
69-
format(INSTANCE_PATH, URI.escape(job), URI.escape(instance))
69+
format(INSTANCE_PATH, CGI::escape(job), CGI::escape(instance))
7070
else
71-
format(PATH, URI.escape(job))
71+
format(PATH, CGI::escape(job))
7272
end
7373
end
7474

spec/prometheus/client/push_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
it 'escapes non-URL characters' do
7474
push = Prometheus::Client::Push.new('bar job', 'foo <my instance>')
7575

76-
expected = '/metrics/job/bar%20job/instance/foo%20%3Cmy%20instance%3E'
76+
expected = '/metrics/job/bar+job/instance/foo+%3Cmy+instance%3E'
7777
expect(push.path).to eql(expected)
7878
end
7979
end

0 commit comments

Comments
 (0)