test:get_object

This commit is contained in:
weisd
2024-07-25 11:22:00 +08:00
parent ac4fe6cd1d
commit 07c6905146
3 changed files with 74 additions and 34 deletions
+11 -3
View File
@@ -155,11 +155,16 @@ impl S3 for FS {
.await
);
// let body = bytes_stream(reader.stream, 100);
let info = reader.object_info;
let content_type = try_!(ContentType::from_str("application/x-msdownload"));
let last_modified = Timestamp::from(info.mod_time);
let output = GetObjectOutput {
body: Some(reader.stream),
content_length: Some(reader.object_info.size as i64),
content_length: Some(info.size as i64),
last_modified: Some(last_modified),
content_type: Some(content_type),
..Default::default()
};
@@ -208,11 +213,12 @@ impl S3 for FS {
debug!("info {:?}", info);
let content_type = try_!(ContentType::from_str("application/x-msdownload"));
let last_modified = Timestamp::from(info.mod_time);
let output = HeadObjectOutput {
content_length: Some(try_!(i64::try_from(info.size))),
content_type: Some(content_type),
last_modified: Some(info.mod_time.into()),
last_modified: Some(last_modified),
// metadata: object_metadata,
..Default::default()
};
@@ -268,6 +274,8 @@ impl S3 for FS {
..
} = input;
debug!("put_object metadata {:?}", metadata);
let Some(body) = body else { return Err(s3_error!(IncompleteBody)) };
let Some(content_length) = content_length else { return Err(s3_error!(IncompleteBody)) };