Datasources: Handle URL parsing error (#25742)

Adds handling of error returned from URL parsing.

Fixes #25714
This commit is contained in:
Marcus Efraimsson
2020-06-22 16:34:40 +02:00
committed by GitHub
parent c16890c22d
commit 58cefe73ee
7 changed files with 28 additions and 8 deletions
+4 -1
View File
@@ -154,7 +154,10 @@ func (e *GraphiteExecutor) parseResponse(res *http.Response) ([]TargetResponseDT
}
func (e *GraphiteExecutor) createRequest(dsInfo *models.DataSource, data url.Values) (*http.Request, error) {
u, _ := url.Parse(dsInfo.Url)
u, err := url.Parse(dsInfo.Url)
if err != nil {
return nil, err
}
u.Path = path.Join(u.Path, "render")
req, err := http.NewRequest(http.MethodPost, u.String(), strings.NewReader(data.Encode()))