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.
This commit is contained in:
kite 2026-06-09 22:24:16 +08:00
parent dd0ebd905e
commit 7fcb9db6a3

View file

@ -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")
}
}