(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestClient_SendRequest(t *testing.T) { |
| 94 | // Setup a test server |
| 95 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 96 | w.WriteHeader(http.StatusOK) |
| 97 | w.Write([]byte("success")) |
| 98 | })) |
| 99 | defer ts.Close() |
| 100 | |
| 101 | client := NewClient() |
| 102 | req := client.Request() |
| 103 | req.SetRequestURI(ts.URL).SetMethod("GET") |
| 104 | |
| 105 | err := client.SendRequest() |
| 106 | if err != nil { |
| 107 | t.Fatalf("expected no error, got %v", err) |
| 108 | } |
| 109 | if client.res.StatusCode != http.StatusOK { |
| 110 | t.Fatalf("expected status code 200, got %d", client.res.StatusCode) |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | func TestClient_SendRequest_MissingURI(t *testing.T) { |
| 115 | client := NewClient() |
nothing calls this directly
no test coverage detected