mirror of https://github.com/fafhrd91/actix-web
Added positive test case for If-Modified-Since
This commit is contained in:
parent
dfff2fd634
commit
9ab2d35e6b
20
src/fs.rs
20
src/fs.rs
|
@ -968,7 +968,25 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_if_modified_since_ignored() {
|
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")
|
let mut file = NamedFile::open("Cargo.toml")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_cpu_pool(CpuPool::new(1));
|
.set_cpu_pool(CpuPool::new(1));
|
||||||
|
|
Loading…
Reference in New Issue