Merge pull request #186 from stapelberg/slash

Strip trailing / from push URL.
This commit is contained in:
Björn Rabenstein 2015-11-27 19:24:33 +01:00
commit 67994f1771
1 changed files with 3 additions and 0 deletions

View File

@ -336,6 +336,9 @@ func (r *registry) Push(job, instance, pushURL, method string) error {
if !strings.Contains(pushURL, "://") {
pushURL = "http://" + pushURL
}
if strings.HasSuffix(pushURL, "/") {
pushURL = pushURL[:len(pushURL)-1]
}
pushURL = fmt.Sprintf("%s/metrics/jobs/%s", pushURL, url.QueryEscape(job))
if instance != "" {
pushURL += "/instances/" + url.QueryEscape(instance)