Skip to content

Commit

Permalink
Improve error message for unsupported protocol scheme with URL context (
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored Dec 1, 2024
1 parent f7afbb4 commit 1ae8cc7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions http/httpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func (jc *HttpClient) Send(method, url string, content []byte, followRedirect, c
}
resp, respBody, redirectUrl, err = jc.doRequest(req, content, followRedirect, closeBody, httpClientsDetails)
if err != nil {
if strings.Contains(err.Error(), "unsupported protocol scheme") {
// Wrong URL, so no need to retry
return false, fmt.Errorf("%w\nThe recieved error indicats an invalid URL: %q, Please ensure the URL includes a valid scheme like 'http://' or 'https://'.", err, url)
}
return true, err
}
// Response must not be nil
Expand Down

0 comments on commit 1ae8cc7

Please sign in to comment.