[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"
"net/http"
"net/url"
"path"
"sort"
"strconv"
"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
// to influxdb and proxy back the db response.
queryURL.Path = fmt.Sprintf("/proxy/%s", INFLUXDB)
req, err := http.NewRequest("POST", queryURL.String(), nil)
queryURL.Path = path.Clean(fmt.Sprintf("%s/proxy/%s", queryURL.Path, INFLUXDB))
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil {
return nil, err
}