mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-07 16:44:50 +08:00
fix(api): strip anthropic beta fields from non-beta requests
mikejiang: 'betas: Extra inputs are not permitted' 400 error. Only include beta headers when request targets beta endpoint.
This commit is contained in:
@@ -97,9 +97,9 @@ async fn send_message_posts_json_and_parses_response() {
|
||||
assert!(body.get("stream").is_none());
|
||||
assert_eq!(body["tools"][0]["name"], json!("get_weather"));
|
||||
assert_eq!(body["tool_choice"]["type"], json!("auto"));
|
||||
assert_eq!(
|
||||
body["betas"],
|
||||
json!(["claude-code-20250219", "prompt-caching-scope-2026-01-05"])
|
||||
assert!(
|
||||
body.get("betas").is_none(),
|
||||
"betas must travel via the anthropic-beta header, not the request body"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -191,13 +191,9 @@ async fn send_message_applies_request_profile_and_records_telemetry() {
|
||||
let body: serde_json::Value =
|
||||
serde_json::from_str(&request.body).expect("request body should be json");
|
||||
assert_eq!(body["metadata"]["source"], json!("clawd-code"));
|
||||
assert_eq!(
|
||||
body["betas"],
|
||||
json!([
|
||||
"claude-code-20250219",
|
||||
"prompt-caching-scope-2026-01-05",
|
||||
"tools-2026-04-01"
|
||||
])
|
||||
assert!(
|
||||
body.get("betas").is_none(),
|
||||
"betas must travel via the anthropic-beta header, not the request body"
|
||||
);
|
||||
|
||||
let events = sink.events();
|
||||
|
||||
Reference in New Issue
Block a user