MCPcopy Create free account
hub / github.com/06chaynes/http-cache / test_cache_analysis_fields

Function test_cache_analysis_fields

http-cache/src/test.rs:979–1014  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

977 .body(())
978 .unwrap();
979 let (parts, _) = req.into_parts();
980 let analysis = cache.analyze_request(&parts, None).unwrap();
981
982 // Cache the response
983 let _processed = cache
984 .process_response(
985 analysis.clone(),
986 response,
987 Some(b"Metadata".to_vec()),
988 )
989 .await
990 .unwrap();
991
992 // Look up the cached response
993 let cached =
994 cache.lookup_cached_response(&analysis.cache_key).await.unwrap();
995 assert!(cached.is_some());
996
997 let (cached_response, policy) = cached.unwrap();
998
999 // Test preparing conditional request
1000 let mut request_parts = parts.clone();
1001 let result = cache.prepare_conditional_request(
1002 &mut request_parts,
1003 &cached_response,
1004 &policy,
1005 );
1006 assert!(result.is_ok());
1007
1008 // Check if conditional headers were added (implementation dependent)
1009 // This tests that the method doesn't panic and returns Ok
1010
1011 // Temporary directory will be automatically cleaned up when dropped
1012 }
1013
1014 #[tokio::test]
1015 async fn test_http_cache_interface_not_modified() {
1016 let cache_dir = tempfile::tempdir().unwrap();
1017 let manager = CACacheManager::new(cache_dir.path().to_path_buf(), true);

Callers

nothing calls this directly

Calls 4

bodyMethod · 0.80
headerMethod · 0.80
analyze_requestMethod · 0.80
methodMethod · 0.45

Tested by

no test coverage detected