mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-07-09 17:28:58 +00:00
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:
parent
dd0ebd905e
commit
7fcb9db6a3
1 changed files with 3 additions and 7 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue