mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-09-03 14:39:26 +08:00
- Introduced `DisableCloakingModelList` in `ClaudeCodeConfig` to control model ID cloaking in Anthropic model list responses. - Updated relevant APIs and handlers to respect the new configuration. - Added comprehensive tests for enabling/disabling cloaking behavior and config-driven hot reload scenarios. - Extended example configuration and documentation to include the new setting. Closes: #4473
35 lines
752 B
Go
35 lines
752 B
Go
package config
|
|
|
|
import "testing"
|
|
|
|
func TestParseConfigBytesClaudeCodeModelListCloaking(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
yaml string
|
|
want bool
|
|
}{
|
|
{
|
|
name: "defaults to enabled cloaking",
|
|
yaml: "port: 8317\n",
|
|
want: false,
|
|
},
|
|
{
|
|
name: "disables model list cloaking",
|
|
yaml: "claude-code:\n disable-cloaking-model-list: true\n",
|
|
want: true,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
cfg, errParse := ParseConfigBytes([]byte(tt.yaml))
|
|
if errParse != nil {
|
|
t.Fatalf("ParseConfigBytes() error = %v", errParse)
|
|
}
|
|
if got := cfg.ClaudeCode.DisableCloakingModelList; got != tt.want {
|
|
t.Fatalf("DisableCloakingModelList = %t, want %t", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|