fix(proxy): remove hardcoded ?beta=true injection, passthrough client query params

- handlers.rs: add `uri` extractor to capture client's full path+query
- claude.rs: remove ?beta=true injection from build_url(), update tests
- stream_check.rs: remove ?beta=true from health check URL

The proxy no longer injects ?beta=true into API URLs. Instead, query
parameters sent by the Claude Code client are transparently passed through.
This fixes duplicate ?beta=true issues and aligns with upstream behavior
where the client already sends this parameter.
This commit is contained in:
YoVinchen
2026-02-25 22:03:17 +08:00
parent e516f83c19
commit 87b08ce242
3 changed files with 20 additions and 27 deletions
+3 -3
View File
@@ -293,11 +293,11 @@ impl StreamCheckService {
timeout: std::time::Duration,
) -> Result<(u16, String), AppError> {
let base = base_url.trim_end_matches('/');
// URL 必须包含 ?beta=true 参数(某些中转服务依赖此参数验证请求来源)
// 健康检查不注入 ?beta=true,依赖 anthropic-beta header 传递身份验证信息
let url = if base.ends_with("/v1") {
format!("{base}/messages?beta=true")
format!("{base}/messages")
} else {
format!("{base}/v1/messages?beta=true")
format!("{base}/v1/messages")
};
let body = json!({