create url_string_test.go
Pretty straightforward testing for URLToString function. But I'm still not quite sure what the following logic in URLToString does so I wasn't able to write a test for it (link):
if strings.Contains(tempHost, ":") && !(strings.HasPrefix(tempHost, "[") && strings.HasSuffix(tempHost, "]")) {
tempHost = "[" + tempHost + "]"
}
@NGTmeaty Because you wrote it, could you add a test that verifies the above code is functioning as intended?
I understand now that the code I referenced above is to handle IPv6 addresses, so I added a test for that functionality as well as a comment in the URLToString function to explain that line which I consider not immediately obvious. @NGTmeaty You can disregard my request above, but feel free to add any test cases I'm missing
Yes indeed, it's for IPV6 IPs to have opening and closing brackets.