fix: query params support + remove duplicate response wrappers + fix tests

This commit is contained in:
2026-07-28 16:45:45 +08:00
parent 4e348031a6
commit 284a503541
6 changed files with 43 additions and 49 deletions
+4 -7
View File
@@ -18,11 +18,8 @@ func TestClientAuthHeader(t *testing.T) {
c := newClient(srv.URL, "sk-test")
var result struct {
Code int `json:"code"`
Data struct {
ID int `json:"id"`
Name string `json:"name"`
} `json:"data"`
ID int `json:"id"`
Name string `json:"name"`
}
if err := c.get(context.Background(), "/test", &result); err != nil {
t.Fatalf("get() error: %v", err)
@@ -30,8 +27,8 @@ func TestClientAuthHeader(t *testing.T) {
if gotKey != "sk-test" {
t.Errorf("X-Api-Key = %q, want %q", gotKey, "sk-test")
}
if result.Data.Name != "test" {
t.Errorf("Data.Name = %q, want %q", result.Data.Name, "test")
if result.Name != "test" {
t.Errorf("Name = %q, want %q", result.Name, "test")
}
}