mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
refactor(body-rules): 移除 protected_body_keys 机制,允许 body_rules 自由修改所有请求体字段
删除 get_cache_sensitive_protected_body_keys 函数及相关常量、_is_protected_path 辅助函数,从 apply_body_rules、RequestBuilder、ProviderRequestResult 等处移除 protected_body_keys 参数,更新所有调用点和测试用例。
This commit is contained in:
@@ -296,15 +296,12 @@ class TestRequestPayloadSummary:
|
||||
summary = summarize_request_payload_shape(
|
||||
payload,
|
||||
provider_api_format="gemini:chat",
|
||||
protected_body_keys=frozenset({"contents", "toolConfig"}),
|
||||
body_rules=[{"action": "drop", "path": "toolConfig"}],
|
||||
)
|
||||
|
||||
assert summary["format"] == "gemini:chat"
|
||||
assert summary["contents_count"] == 1
|
||||
assert summary["message_count"] is None
|
||||
assert summary["protected_body_keys_enabled"] is True
|
||||
assert summary["protected_body_keys"] == ["contents", "toolConfig"]
|
||||
assert summary["body_rule_count"] == 1
|
||||
assert summary["top_level_keys"] == ["contents"]
|
||||
|
||||
@@ -319,7 +316,6 @@ class TestRequestPayloadSummary:
|
||||
summary = summarize_request_payload_shape(
|
||||
payload,
|
||||
provider_api_format="gemini:chat",
|
||||
protected_body_keys=None,
|
||||
body_rules=None,
|
||||
)
|
||||
|
||||
@@ -330,7 +326,6 @@ class TestRequestPayloadSummary:
|
||||
assert summary["tool_count"] is None
|
||||
assert summary["format"] == "gemini:chat"
|
||||
assert summary["contents_count"] == 1
|
||||
assert summary["protected_body_keys_enabled"] is False
|
||||
assert summary["body_rule_count"] == 0
|
||||
assert summary["top_level_keys"] == [
|
||||
"contents",
|
||||
|
||||
Reference in New Issue
Block a user