mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
feat: supports resumable uploads (#343)
This commit is contained in:
@@ -250,9 +250,12 @@ fn options_dir(server: TestServer) -> Result<(), Error> {
|
||||
assert_eq!(resp.status(), 200);
|
||||
assert_eq!(
|
||||
resp.headers().get("allow").unwrap(),
|
||||
"GET,HEAD,PUT,OPTIONS,DELETE,PROPFIND,COPY,MOVE"
|
||||
"GET,HEAD,PUT,OPTIONS,DELETE,PATCH,PROPFIND,COPY,MOVE"
|
||||
);
|
||||
assert_eq!(
|
||||
resp.headers().get("dav").unwrap(),
|
||||
"1, 2, 3, sabredav-partialupdate"
|
||||
);
|
||||
assert_eq!(resp.headers().get("dav").unwrap(), "1,2");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -330,3 +333,19 @@ fn get_file_content_type(server: TestServer) -> Result<(), Error> {
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn resumable_upload(#[with(&["--allow-upload"])] server: TestServer) -> Result<(), Error> {
|
||||
let url = format!("{}file1", server.url());
|
||||
let resp = fetch!(b"PUT", &url).body(b"abc".to_vec()).send()?;
|
||||
assert_eq!(resp.status(), 201);
|
||||
let resp = fetch!(b"PATCH", &url)
|
||||
.header("X-Update-Range", "append")
|
||||
.body(b"123".to_vec())
|
||||
.send()?;
|
||||
assert_eq!(resp.status(), 204);
|
||||
let resp = reqwest::blocking::get(url)?;
|
||||
assert_eq!(resp.status(), 200);
|
||||
assert_eq!(resp.text().unwrap(), "abc123");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user