mirror of https://github.com/fafhrd91/actix-web
test
This commit is contained in:
parent
2e1d761854
commit
e410bf2dc3
|
@ -279,6 +279,22 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn test_named_file_javascript() {
|
||||||
|
let file = NamedFile::open("tests/test.js").unwrap();
|
||||||
|
|
||||||
|
let req = TestRequest::default().to_http_request();
|
||||||
|
let resp = file.respond_to(&req).await.unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
resp.headers().get(header::CONTENT_TYPE).unwrap(),
|
||||||
|
"application/javascript"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
resp.headers().get(header::CONTENT_DISPOSITION).unwrap(),
|
||||||
|
"inline; filename=\"test.js\""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn test_named_file_image_attachment() {
|
async fn test_named_file_image_attachment() {
|
||||||
let cd = ContentDisposition {
|
let cd = ContentDisposition {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
// this file is empty.
|
Loading…
Reference in New Issue