Skip to content

Commit 9d57e68

Browse files
committed
Improve error message when an API URL is constructed with missing parameters
1 parent a6b5fa4 commit 9d57e68

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## X.Y.Z (Unreleased)
22
* Add new change notes here
33

4+
ENHANCEMENTS:
5+
* Improve error message when an API URL is constructed with missing parameters
6+
47
## 3.0.8 (April 1, 2025)
58

69
BUG FIXES:

sumologic/sumologic_client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"log"
1010
"net/http"
1111
"net/url"
12+
"strings"
1213
"time"
1314

1415
"github.com/hashicorp/go-retryablehttp"
@@ -50,6 +51,9 @@ func (s *Client) createSumoRequest(method, relativeURL string, body io.Reader) (
5051
if err != nil {
5152
return nil, err
5253
}
54+
if strings.Contains(relativeURL, "//") {
55+
return nil, fmt.Errorf("malformed URL contains '//' in the path: %s", relativeURL)
56+
}
5357

5458
fullURL := s.BaseURL.ResolveReference(parsedRelativeURL).String()
5559
req, err := createNewRequest(method, fullURL, body, s.AccessID, s.AccessKey, s.AuthJwt)

0 commit comments

Comments
 (0)