fix: handle URLs already ending in /jsonrpc.php
NewClient() now detects when the provided URL already ends with /jsonrpc.php and avoids appending it again. This prevents double-path issues like /jsonrpc.php/jsonrpc.php. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f8daa20ddd
commit
96601980c3
4 changed files with 27 additions and 4 deletions
|
|
@ -29,9 +29,15 @@ func NewClient(baseURL string) *Client {
|
|||
// Ensure no trailing slash
|
||||
baseURL = strings.TrimSuffix(baseURL, "/")
|
||||
|
||||
// Handle URLs that already include /jsonrpc.php
|
||||
endpoint := baseURL
|
||||
if !strings.HasSuffix(baseURL, "/jsonrpc.php") {
|
||||
endpoint = baseURL + "/jsonrpc.php"
|
||||
}
|
||||
|
||||
c := &Client{
|
||||
baseURL: baseURL,
|
||||
endpoint: baseURL + "/jsonrpc.php",
|
||||
endpoint: endpoint,
|
||||
}
|
||||
|
||||
c.httpClient = &http.Client{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue