fix(ci): resolve lint header casing and fallback test routing

This commit is contained in:
lc6464 2026-04-11 02:23:35 +08:00
parent b73caebe6f
commit 86917faa9b
No known key found for this signature in database
GPG key ID: 53C61B42FEC71D6D
3 changed files with 8 additions and 8 deletions

View file

@ -1921,7 +1921,7 @@ func TestProcessMessage_FallbackUsesPerCandidateProvider(t *testing.T) {
}, },
{ {
ModelName: "gemma-fallback", ModelName: "gemma-fallback",
Model: "gemini/gemma-3-27b-it", Model: "openrouter/gemma-3-27b-it",
APIBase: fallbackServer.URL, APIBase: fallbackServer.URL,
APIKeys: config.SimpleSecureStrings("fallback-key"), APIKeys: config.SimpleSecureStrings("fallback-key"),
Workspace: workspace, Workspace: workspace,

View file

@ -153,7 +153,7 @@ func (p *GeminiProvider) ChatStream(
func (p *GeminiProvider) applyHeaders(req *http.Request) { func (p *GeminiProvider) applyHeaders(req *http.Request) {
req.Header.Set("Content-Type", "application/json") req.Header.Set("Content-Type", "application/json")
if p.apiKey != "" { if p.apiKey != "" {
req.Header.Set("x-goog-api-key", p.apiKey) req.Header.Set("X-Goog-Api-Key", p.apiKey)
} }
if p.userAgent != "" { if p.userAgent != "" {
req.Header.Set("User-Agent", p.userAgent) req.Header.Set("User-Agent", p.userAgent)

View file

@ -19,8 +19,8 @@ func TestGeminiProvider_ChatSeparatesThoughtAndToolCall(t *testing.T) {
if !strings.Contains(r.URL.Path, ":generateContent") { if !strings.Contains(r.URL.Path, ":generateContent") {
t.Fatalf("path = %s, expected generateContent endpoint", r.URL.Path) t.Fatalf("path = %s, expected generateContent endpoint", r.URL.Path)
} }
if got := r.Header.Get("x-goog-api-key"); got != "test-key" { if got := r.Header.Get("X-Goog-Api-Key"); got != "test-key" {
t.Fatalf("x-goog-api-key = %q, want %q", got, "test-key") t.Fatalf("X-Goog-Api-Key = %q, want %q", got, "test-key")
} }
if err := json.NewDecoder(r.Body).Decode(&capturedBody); err != nil { if err := json.NewDecoder(r.Body).Decode(&capturedBody); err != nil {
t.Fatalf("decode request body: %v", err) t.Fatalf("decode request body: %v", err)
@ -489,8 +489,8 @@ func TestGeminiProvider_ChatAllowsCustomAuthHeaderWithoutAPIKey(t *testing.T) {
if got := r.Header.Get("Authorization"); got != "Bearer test-token" { if got := r.Header.Get("Authorization"); got != "Bearer test-token" {
t.Fatalf("Authorization = %q, want %q", got, "Bearer test-token") t.Fatalf("Authorization = %q, want %q", got, "Bearer test-token")
} }
if got := r.Header.Get("x-goog-api-key"); got != "" { if got := r.Header.Get("X-Goog-Api-Key"); got != "" {
t.Fatalf("x-goog-api-key = %q, want empty", got) t.Fatalf("X-Goog-Api-Key = %q, want empty", got)
} }
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]any{ _ = json.NewEncoder(w).Encode(map[string]any{
@ -533,8 +533,8 @@ func TestGeminiProvider_ChatAllowsCustomAuthHeaderWithoutAPIKey(t *testing.T) {
func TestGeminiProvider_ChatAllowsMissingAPIKeyForCustomAPIBase(t *testing.T) { func TestGeminiProvider_ChatAllowsMissingAPIKeyForCustomAPIBase(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if got := r.Header.Get("x-goog-api-key"); got != "" { if got := r.Header.Get("X-Goog-Api-Key"); got != "" {
t.Fatalf("x-goog-api-key = %q, want empty", got) t.Fatalf("X-Goog-Api-Key = %q, want empty", got)
} }
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]any{ _ = json.NewEncoder(w).Encode(map[string]any{