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 -2
View File
@@ -154,12 +154,14 @@ func (c *baseClientImpl) encodeBatchRequests(requests []*multiRequest) ([]byte,
}
func (c *baseClientImpl) executeRequest(method, uriPath, uriQuery string, body []byte) (*response, error) {
u, _ := url.Parse(c.ds.Url)
u, err := url.Parse(c.ds.Url)
if err != nil {
return nil, err
}
u.Path = path.Join(u.Path, uriPath)
u.RawQuery = uriQuery
var req *http.Request
var err error
if method == http.MethodPost {
req, err = http.NewRequest(http.MethodPost, u.String(), bytes.NewBuffer(body))
} else {