Skip to content

Commit 0fc4be7

Browse files
authored
Use SplitN to parse basic auth string, fixes #210 (#211)
1 parent 77f22ba commit 0fc4be7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest-request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func NewClient(apiURL, apiKeyOrBasicAuth string, client *http.Client) (*Client,
6969
if !basicAuth {
7070
key = fmt.Sprintf("Bearer %s", apiKeyOrBasicAuth)
7171
} else {
72-
parts := strings.Split(apiKeyOrBasicAuth, ":")
72+
parts := strings.SplitN(apiKeyOrBasicAuth, ":", 2)
7373
baseURL.User = url.UserPassword(parts[0], parts[1])
7474
}
7575
}

0 commit comments

Comments
 (0)