Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use opendal method instead of write by hand #1050

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions tests/behavior/presign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::str::FromStr;
use anyhow::Result;
use http::header;
use log::debug;
use opendal::Operator;
use opendal::{raw, Operator};
use reqwest::Url;
use sha2::Digest;
use sha2::Sha256;
Expand Down Expand Up @@ -134,15 +134,10 @@ pub async fn test_presign_stat(op: Operator) -> Result<()> {
}
let resp = req.send().await.expect("send request must succeed");
assert_eq!(resp.status(), http::StatusCode::OK, "status ok",);
// response headers default content_length method cannot get the correct value
let content_length = resp
.headers()
.get(header::CONTENT_LENGTH)
.expect("content length must exist")
.to_str()
.expect("content length must be valid str")
.parse::<u64>()
.expect("content length must be valid u64");

let content_length = raw::parse_content_length(resp.headers())
.expect("no content length")
.expect("content length must be present");
assert_eq!(content_length, size as u64);
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved

op.object(&path)
Expand Down