net-http icon indicating copy to clipboard operation
net-http copied to clipboard

No test coverage for ipaddr in HTTP.start

Open collimarco opened this issue 1 year ago • 0 comments
trafficstars

We use a code like this:

request = Net::HTTP::Get.new(uri.request_uri)

Net::HTTP.start(uri.hostname, uri.port, ipaddr: ip, use_ssl: true) do |http|
  http.request(request)
end

What I have noticed is that it is difficult to see if ipaddr is actually used for the request... If there is a change in the future the ipaddr param may be just ignored and nobody will notice.

Furthermore I have noticed that in the code of this gem there is no test coverage for the ipaddr parameter passed to HTTP.start.

  • Is there a more "solid" and "future-proof" solution to set the ipaddr in the above code?
  • Can you add test coverage for this parameter so that it won't break in future versions?

collimarco avatar Nov 04 '24 21:11 collimarco