use num
This commit is contained in:
@@ -20,9 +20,6 @@ pub const OSS_VERB_DELETE: &str = "DELETE";
|
||||
const HTTP_SS: &str = "http://";
|
||||
const HTTPS_SS: &str = "https://";
|
||||
|
||||
const HTTP_SC_SUCCESS: u16 = 200;
|
||||
const HTTP_SC_NOT_FOUND: u16 = 404;
|
||||
|
||||
const INTERNAL_DEFAULT_VALID_IN_SECS: u64 = 30;
|
||||
|
||||
// https://help.aliyun.com/document_detail/31952.html
|
||||
@@ -56,8 +53,8 @@ impl OSSClient {
|
||||
let get_url = self.generate_signed_get_url(bucket_name, key, INTERNAL_DEFAULT_VALID_IN_SECS);
|
||||
let mut response = reqwest::get(&get_url)?;
|
||||
match response.status().as_u16() {
|
||||
HTTP_SC_NOT_FOUND => Ok(None),
|
||||
HTTP_SC_SUCCESS => Ok(Some(response.text()?)),
|
||||
404_u16 => Ok(None),
|
||||
200_u16 => Ok(Some(response.text()?)),
|
||||
_ => Err(new_box_ioerror(&format!("Error in read: {}/{}, returns: {:?}", bucket_name, key, response))),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user