From 1ae8cc74d08d7b48596a938d703435a4398debdb Mon Sep 17 00:00:00 2001 From: Michael Sverdlov Date: Sun, 1 Dec 2024 01:45:19 -0800 Subject: [PATCH] Improve error message for unsupported protocol scheme with URL context (#1051) --- http/httpclient/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http/httpclient/client.go b/http/httpclient/client.go index bc829797e..93800932e 100644 --- a/http/httpclient/client.go +++ b/http/httpclient/client.go @@ -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