Repository: actix/actix-web
File: src/fs.rs (Rust)

Code before:
    }

    #[test]
    fn test_if_modified_since_ignored() {
        let mut file = NamedFile::open("Cargo.toml")
            .unwrap()
            .set_cpu_pool(CpuPool::new(1));
        let since = header::HttpDate::from(
            SystemTime::now().add(Duration::from_secs(60)));

        let req = TestRequest::default()
            .header(header::IF_NONE_MATCH, "miss_etag")
            .header(header::IF_MODIFIED_SINCE, since)
            .finish();
        let resp = file.respond_to(&req).unwrap();
        assert_ne!(
            resp.status(),
            StatusCode::NOT_MODIFIED
        );
    }

    #[test]
    fn test_named_file_text() {
        assert!(NamedFile::open("test--").is_err());
        let mut file = NamedFile::open("Cargo.toml")
            .unwrap()
            .set_cpu_pool(CpuPool::new(1));
        {
            file.file();
            let _f: &File = &file;
        }
        {
            let _f: &mut File = &mut file;
        }

        let req = TestRequest::default().finish();
        let resp = file.respond_to(&req).unwrap();
        assert_eq!(
            resp.headers().get(header::CONTENT_TYPE).unwrap(),
            "text/x-toml"
        );
        assert_eq!(
            resp.headers().get(header::CONTENT_DISPOSITION).unwrap(),
            "inline; filename=\"Cargo.toml\""
        );
    }

    #[test]
    fn test_named_file_set_content_type() {
        let mut file = NamedFile::open("Cargo.toml")
            .unwrap()

Review comment (suggestion):
Sorry, I forgot one thing: could you please check if we have positive test case for `If-Modified-Since` if not, I'd appreicate if you could add it.

i.e. the same test but with no `IF_NONE_MATCH` header

Code after:
    }

    #[test]
    fn test_if_modified_since_without_if_none_match() {
        let mut file = NamedFile::open("Cargo.toml")
            .unwrap()
            .set_cpu_pool(CpuPool::new(1));
        let since = header::HttpDate::from(
            SystemTime::now().add(Duration::from_secs(60)));

        let req = TestRequest::default()
            .header(header::IF_MODIFIED_SINCE, since)
            .finish();
        let resp = file.respond_to(&req).unwrap();
        assert_eq!(
            resp.status(),
            StatusCode::NOT_MODIFIED
        );
    }

    #[test]
    fn test_if_modified_since_with_if_none_match() {
        let mut file = NamedFile::open("Cargo.toml")
            .unwrap()
            .set_cpu_pool(CpuPool::new(1));
        let since = header::HttpDate::from(
            SystemTime::now().add(Duration::from_secs(60)));

        let req = TestRequest::default()
            .header(header::IF_NONE_MATCH, "miss_etag")
            .header(header::IF_MODIFIED_SINCE, since)
            .finish();
        let resp = file.respond_to(&req).unwrap();
        assert_ne!(
            resp.status(),
            StatusCode::NOT_MODIFIED
        );
    }

    #[test]
    fn test_named_file_text() {
        assert!(NamedFile::open("test--").is_err());
        let mut file = NamedFile::open("Cargo.toml")
            .unwrap()
            .set_cpu_pool(CpuPool::new(1));
        {
            file.file();
            let _f: &File = &file;
        }
        {
            let _f: &mut File = &mut file;