Skip to content

Commit

Permalink
Moving to CGI.escape for Ruby 3
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Dec 5, 2023
1 parent 72aaecc commit 3b6b762
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/test/resources/delegates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'java'
require 'uri'
require 'cgi'

class CustomDelegate

Expand Down Expand Up @@ -166,33 +167,33 @@ def httpsource_resource_info(options = {})
elsif context['client_ip'] == '1.2.3.4'
if context['request_headers']['X-Forwarded-Proto'] == 'https'
return {
'uri' => 'https://other-example.org/bleh/' + URI.escape(identifier)
'uri' => 'https://other-example.org/bleh/' + CGI.escape(identifier)
}
else
return {
'uri' => 'http://other-example.org/bleh/' + URI.escape(identifier)
'uri' => 'http://other-example.org/bleh/' + CGI.escape(identifier)
}
end
end

case identifier
when 'http-jpg-rgb-64x56x8-baseline.jpg'
return {
'uri' => 'http://example.org/bla/' + URI.escape(identifier),
'uri' => 'http://example.org/bla/' + CGI.escape(identifier),
'headers' => {
'X-Custom' => 'yes'
}
}
when 'https-jpg-rgb-64x56x8-baseline.jpg'
return {
'uri' => 'https://example.org/bla/' + URI.escape(identifier),
'uri' => 'https://example.org/bla/' + CGI.escape(identifier),
'headers' => {
'X-Custom' => 'yes'
}
}
when 'http-jpg-rgb-64x56x8-plane.jpg'
return {
'uri' => 'http://example.org/bla/' + URI.escape(identifier),
'uri' => 'http://example.org/bla/' + CGI.escape(identifier),
'username' => 'username',
'secret' => 'secret',
'headers' => {
Expand All @@ -201,7 +202,7 @@ def httpsource_resource_info(options = {})
}
when 'https-jpg-rgb-64x56x8-plane.jpg'
return {
'uri' => 'https://example.org/bla/' + URI.escape(identifier),
'uri' => 'https://example.org/bla/' + CGI.escape(identifier),
'username' => 'username',
'secret' => 'secret',
'headers' => {
Expand Down

0 comments on commit 3b6b762

Please sign in to comment.