From f31bdcb8eda943f8ddf720e0b9d65ac22124cc93 Mon Sep 17 00:00:00 2001 From: Daniel Magliola Date: Thu, 21 May 2020 10:40:46 +0100 Subject: [PATCH] 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 --- lib/prometheus/client/push.rb | 4 ++-- spec/prometheus/client/push_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/prometheus/client/push.rb b/lib/prometheus/client/push.rb index fe8cc2ab..03efb9f7 100644 --- a/lib/prometheus/client/push.rb +++ b/lib/prometheus/client/push.rb @@ -66,9 +66,9 @@ def parse(url) def build_path(job, instance) if instance - format(INSTANCE_PATH, URI.escape(job), URI.escape(instance)) + format(INSTANCE_PATH, CGI::escape(job), CGI::escape(instance)) else - format(PATH, URI.escape(job)) + format(PATH, CGI::escape(job)) end end diff --git a/spec/prometheus/client/push_spec.rb b/spec/prometheus/client/push_spec.rb index dc35e060..f84748e3 100644 --- a/spec/prometheus/client/push_spec.rb +++ b/spec/prometheus/client/push_spec.rb @@ -73,7 +73,7 @@ it 'escapes non-URL characters' do push = Prometheus::Client::Push.new('bar job', 'foo ') - expected = '/metrics/job/bar%20job/instance/foo%20%3Cmy%20instance%3E' + expected = '/metrics/job/bar+job/instance/foo+%3Cmy+instance%3E' expect(push.path).to eql(expected) end end