()
| 870 | .status(StatusCode::OK) |
| 871 | .header("cache-control", "max-age=3600") |
| 872 | .header("content-type", "text/plain") |
| 873 | .body(b"Hello, world!".to_vec()) |
| 874 | .unwrap(); |
| 875 | |
| 876 | // Analyze a request for this response |
| 877 | let req = Request::builder() |
| 878 | .method("GET") |
| 879 | .uri("https://example.com/test") |
| 880 | .body(()) |
| 881 | .unwrap(); |
| 882 | let (parts, _) = req.into_parts(); |
| 883 | let analysis = cache.analyze_request(&parts, None).unwrap(); |
| 884 | |
| 885 | // Process the response (should cache it) |
| 886 | let processed = cache |
| 887 | .process_response( |
| 888 | analysis.clone(), |
| 889 | response, |
| 890 | Some(b"Metadata".to_vec()), |
| 891 | ) |
| 892 | .await |
| 893 | .unwrap(); |
| 894 | assert_eq!(processed.status(), StatusCode::OK); |
| 895 | |
| 896 | // Try to look up the cached response |
| 897 | let cached = |
nothing calls this directly
no test coverage detected