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

Function test_custom_cache_key_generation

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

Source from the content-addressed store, hash-verified

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 =

Callers

nothing calls this directly

Calls 3

bodyMethod · 0.80
analyze_requestMethod · 0.80
methodMethod · 0.45

Tested by

no test coverage detected