mod test_valid_session_cache_in_preprocess {
use potato::{http_get, preprocess};
#[preprocess]
async fn my_preprocess_with_session(
_req: &mut potato::HttpRequest,
_session_cache: &mut potato::SessionCache,
) {
}
#[http_get("/")]
#[preprocess(my_preprocess_with_session)]
async fn handler_with_session(
_req: &mut potato::HttpRequest,
_session_cache: &mut potato::SessionCache,
) -> potato::HttpResponse {
potato::HttpResponse::text("OK")
}
}
mod test_valid_session_cache_in_postprocess {
use potato::{http_get, postprocess};
#[postprocess]
async fn my_postprocess_with_session(
_req: &mut potato::HttpRequest,
_res: &mut potato::HttpResponse,
_session_cache: &mut potato::SessionCache,
) {
}
#[http_get("/")]
#[postprocess(my_postprocess_with_session)]
async fn handler_with_session(
_req: &mut potato::HttpRequest,
_session_cache: &mut potato::SessionCache,
) -> potato::HttpResponse {
potato::HttpResponse::text("OK")
}
}
mod test_no_session_cache {
use potato::{http_get, preprocess};
#[preprocess]
async fn my_preprocess_no_session(_req: &mut potato::HttpRequest) {}
#[http_get("/")]
#[preprocess(my_preprocess_no_session)]
async fn handler_no_session(_req: &mut potato::HttpRequest) -> potato::HttpResponse {
potato::HttpResponse::text("OK")
}
}
#[tokio::test]
async fn test_session_cache_compile_check() {
println!("✅ SessionCache compile check test passed");
}