Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create url_string_test.go #97

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

create url_string_test.go #97

wants to merge 2 commits into from

Conversation

willmhowes
Copy link
Collaborator

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?

@willmhowes willmhowes requested a review from NGTmeaty July 25, 2024 16:48
@willmhowes
Copy link
Collaborator Author

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

@CorentinB
Copy link
Collaborator

Yes indeed, it's for IPV6 IPs to have opening and closing brackets.

@CorentinB CorentinB added the enhancement New feature or request label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants