(t *testing.T)
| 1190 | } |
| 1191 | |
| 1192 | func TestVersionHeader_SentWhenConfigured(t *testing.T) { |
| 1193 | mock := testutil.NewMockAPI() |
| 1194 | defer mock.Close() |
| 1195 | |
| 1196 | mock.On("GET", "/monitors", 200, `{}`) |
| 1197 | |
| 1198 | viper.Set("CRONITOR_API_VERSION", "2025-11-28") |
| 1199 | defer viper.Set("CRONITOR_API_VERSION", "") |
| 1200 | |
| 1201 | client := newTestClient(mock.Server.URL) |
| 1202 | _, err := client.GET("/monitors", nil) |
| 1203 | if err != nil { |
| 1204 | t.Fatalf("unexpected error: %v", err) |
| 1205 | } |
| 1206 | |
| 1207 | req := mock.LastRequest() |
| 1208 | if cv := req.Headers.Get("Cronitor-Version"); cv != "2025-11-28" { |
| 1209 | t.Errorf("expected Cronitor-Version 2025-11-28, got %q", cv) |
| 1210 | } |
| 1211 | } |
| 1212 | |
| 1213 | func TestVersionHeader_DifferentVersionValues(t *testing.T) { |
| 1214 | mock := testutil.NewMockAPI() |
nothing calls this directly
no test coverage detected