mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-01 04:02:02 +08:00
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:
@@ -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!({
|
||||
|
||||
Reference in New Issue
Block a user