From 7fcb9db6a3bb6b3be62782f30f38e4735c6dadc2 Mon Sep 17 00:00:00 2001 From: kite Date: Tue, 9 Jun 2026 22:24:16 +0800 Subject: [PATCH] fix: correct auth_header test to expect rejection of unsupported values NormalizeAuthHeader only accepts "x-api-key" and "authorization". The test was incorrectly expecting custom headers to be accepted and trimmed. --- cmd/opencodereview/config_cmd_test.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/opencodereview/config_cmd_test.go b/cmd/opencodereview/config_cmd_test.go index 463fa6c..cb31424 100644 --- a/cmd/opencodereview/config_cmd_test.go +++ b/cmd/opencodereview/config_cmd_test.go @@ -14,14 +14,10 @@ func TestSetConfigValueAuthHeaderNormalizesKnownValues(t *testing.T) { } } -func TestSetConfigValueAuthHeaderTrimsCustomHeader(t *testing.T) { +func TestSetConfigValueAuthHeaderRejectsCustomHeader(t *testing.T) { cfg := &Config{} - if err := setConfigValue(cfg, "llm.auth_header", " X-Custom-Auth "); err != nil { - t.Fatalf("setConfigValue: %v", err) - } - - if cfg.Llm.AuthHeader != "X-Custom-Auth" { - t.Errorf("AuthHeader = %q, want %q", cfg.Llm.AuthHeader, "X-Custom-Auth") + if err := setConfigValue(cfg, "llm.auth_header", " X-Custom-Auth "); err == nil { + t.Fatal("expected error for unsupported auth_header, got nil") } }