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

HTTP checker fails to verify error returned by http.NewRequestWithContext #579

Open
alnvdl-work opened this issue Feb 28, 2025 · 1 comment · May be fixed by #580
Open

HTTP checker fails to verify error returned by http.NewRequestWithContext #579

alnvdl-work opened this issue Feb 28, 2025 · 1 comment · May be fixed by #580

Comments

@alnvdl-work
Copy link

The error returned by this line is not being checked:

request, err := http.NewRequestWithContext(ctx, "GET", c.url, nil)

While the most likely error scenario would be invalid URLs (which wouldn't be a problem if the caller is validating the URL beforehand), http.NewRequestWithContext unfortunately makes no guarantees as to when it will returns errors: https://pkg.go.dev/net/http#NewRequestWithContext

@benhoyt
Copy link
Contributor

benhoyt commented Feb 28, 2025

Thanks! I'm fixing this and other issues over at #580 -- feel free to comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants