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
|
|
@ -44,6 +44,22 @@ func TestNewClient_Subdirectory(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestNewClient_WithJsonrpcPhpSuffix(t *testing.T) {
|
||||
client := NewClient("https://example.com/jsonrpc.php")
|
||||
|
||||
if client.endpoint != "https://example.com/jsonrpc.php" {
|
||||
t.Errorf("expected endpoint='https://example.com/jsonrpc.php', got %s", client.endpoint)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewClient_SubdirectoryWithJsonrpcPhpSuffix(t *testing.T) {
|
||||
client := NewClient("https://example.com/kanboard/jsonrpc.php")
|
||||
|
||||
if client.endpoint != "https://example.com/kanboard/jsonrpc.php" {
|
||||
t.Errorf("expected endpoint='https://example.com/kanboard/jsonrpc.php', got %s", client.endpoint)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultTimeout(t *testing.T) {
|
||||
if DefaultTimeout != 30*time.Second {
|
||||
t.Errorf("expected DefaultTimeout=30s, got %v", DefaultTimeout)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue