(root: &serde_json::Map<String, Value>)
| 1004 | } |
| 1005 | |
| 1006 | fn existing_cache_breakpoint_count(root: &serde_json::Map<String, Value>) -> usize { |
| 1007 | let mut count = 0; |
| 1008 | |
| 1009 | if root.contains_key("cache_control") { |
| 1010 | count += 1; |
| 1011 | } |
| 1012 | |
| 1013 | if let Some(system) = root.get("system") { |
| 1014 | count += count_cache_controls_in_content(system); |
| 1015 | } |
| 1016 | |
| 1017 | if let Some(messages) = root.get("messages").and_then(Value::as_array) { |
| 1018 | for message in messages { |
| 1019 | let Some(content) = message.as_object().and_then(|item| item.get("content")) else { |
| 1020 | continue; |
| 1021 | }; |
| 1022 | count += count_cache_controls_in_content(content); |
| 1023 | } |
| 1024 | } |
| 1025 | |
| 1026 | count |
| 1027 | } |
| 1028 | |
| 1029 | fn count_cache_controls_in_content(content: &Value) -> usize { |
| 1030 | match content { |
no test coverage detected