[bugfix] Fix CLI drops controller URL path when querying logs (#1201)

This commit is contained in:
moluzhang
2019-06-17 18:31:02 +09:00
committed by Ta-Ching Chen
parent e189ac4fc2
commit 5445b75af9
+3 -2
View File
@@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"net/url" "net/url"
"path"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@@ -144,8 +145,8 @@ func (influx InfluxDB) query(query influxdbClient.Query) (*influxdbClient.Respon
} }
// connect to controller first, then controller will redirect our query command // connect to controller first, then controller will redirect our query command
// to influxdb and proxy back the db response. // to influxdb and proxy back the db response.
queryURL.Path = fmt.Sprintf("/proxy/%s", INFLUXDB) queryURL.Path = path.Clean(fmt.Sprintf("%s/proxy/%s", queryURL.Path, INFLUXDB))
req, err := http.NewRequest("POST", queryURL.String(), nil) req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }