Skip to content

Commit

Permalink
Remove call to deprecated URI.escape
Browse files Browse the repository at this point in the history
This method has been deprecated for a while, and it gives us warnings in
Ruby 2.7
  • Loading branch information
Daniel Magliola committed May 21, 2020
1 parent c80c550 commit 2ef952f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/prometheus/client/push.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/prometheus/client/push_spec.rb
Expand Up @@ -73,7 +73,7 @@
it 'escapes non-URL characters' do
push = Prometheus::Client::Push.new('bar job', 'foo <my instance>')

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
Expand Down

0 comments on commit 2ef952f

Please sign in to comment.