mirror of https://github.com/fafhrd91/actix-web
[actix-files] add test for custom guards in Files
This commit is contained in:
parent
86436bb4fe
commit
d4adab28de
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue