(t *testing.T)
| 172 | } |
| 173 | |
| 174 | func TestConfigOverrideHandler(t *testing.T) { |
| 175 | cfg := &Config{ |
| 176 | CustomConfigHandler: func(_ any, _ any) http.HandlerFunc { |
| 177 | return func(w http.ResponseWriter, r *http.Request) { |
| 178 | _, err := w.Write([]byte("config")) |
| 179 | assert.NoError(t, err) |
| 180 | } |
| 181 | }, |
| 182 | } |
| 183 | |
| 184 | req := httptest.NewRequest("GET", "http://test.com/config", nil) |
| 185 | w := httptest.NewRecorder() |
| 186 | |
| 187 | h := cfg.configHandler( |
| 188 | struct{ name string }{name: "actual"}, |
| 189 | struct{ name string }{name: "default"}, |
| 190 | ) |
| 191 | h(w, req) |
| 192 | resp := w.Result() |
| 193 | assert.Equal(t, 200, resp.StatusCode) |
| 194 | |
| 195 | body, err := io.ReadAll(resp.Body) |
| 196 | assert.NoError(t, err) |
| 197 | assert.Equal(t, []byte("config"), body) |
| 198 | } |
| 199 | |
| 200 | func TestBuildInfoAPI(t *testing.T) { |
| 201 | type buildInfo struct { |
nothing calls this directly
no test coverage detected