httpclient
httpclient copied to clipboard
Invalid URL scheme should throw an exception
HTTPClient doesn't handle properly invalid schemes, and instead of throwing an exception it takes a long time until it timeouts instead.
HTTPClient.new.get('zzz://test.com')
HTTPClient::ConnectTimeoutError: execution expired
A better way to handle, would be to throw an exception, like when the scheme is missing, e.g.
HTTPClient.new.get('//test.com')
ArgumentError: Request URI must have schema. Possibly add 'http://' to the request URI?