-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow paths without a leading slash in probes #15681
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: skonto The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15681 +/- ##
==========================================
+ Coverage 80.78% 80.83% +0.04%
==========================================
Files 222 222
Lines 18025 18025
==========================================
+ Hits 14561 14570 +9
+ Misses 3092 3085 -7
+ Partials 372 370 -2 ☔ View full report in Codecov by Sentry. |
I noticed this warning.
cc @dprotaso is this a false positive as the version is v4.0.2? |
/assign @dprotaso |
@dprotaso gentle ping. |
8821c8f
to
0f8e118
Compare
@@ -111,7 +112,7 @@ var transport = func() *http.Transport { | |||
}() | |||
|
|||
func getURL(config HTTPProbeConfigOptions) (*url.URL, error) { | |||
return url.Parse(string(config.Scheme) + "://" + net.JoinHostPort(config.Host, config.Port.String()) + config.Path) | |||
return url.Parse(string(config.Scheme) + "://" + net.JoinHostPort(config.Host, config.Port.String()) + "/" + strings.TrimPrefix(config.Path, "/")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just construct a URL struct instead of building a url string and then parsing it.
eg. url.URL handles normalizing the url - see: https://go.dev/play/p/BC7UV63Drih
u1 = url.URL{
Scheme: "http",
Path: "/blah",
Host: net.JoinHostPort("host", "port"),
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh and lets add a unit test so we don't regress in the future
Fixes #15673
Proposed Changes