diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index 21d934310..7fc3c45c4 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -611,6 +611,7 @@ mod tests { use bytes::BytesMut; use super::*; + use actix_web::guard; use actix_web::http::header::{ self, ContentDisposition, DispositionParam, DispositionType, }; @@ -1066,6 +1067,24 @@ mod tests { assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED); } + #[test] + fn test_files_guards() { + let mut srv = test::init_service( + App::new().service( + Files::new("/", ".") + .use_guards(guard::Post()) + ), + ); + + let req = TestRequest::default() + .uri("/Cargo.toml") + .method(Method::POST) + .to_request(); + + let resp = test::call_service(&mut srv, req); + assert_eq!(resp.status(), StatusCode::OK); + } + #[test] fn test_named_file_content_encoding() { let mut srv = test::init_service(App::new().wrap(Compress::default()).service(