mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-30 16:59:52 +00:00
feat(s3): advance parity coverage (#2278)
This commit is contained in:
@@ -16,6 +16,7 @@ use anyhow::{Context, Result};
|
||||
use aws_sdk_s3::config::{Credentials, Region};
|
||||
use aws_sdk_s3::primitives::ByteStream;
|
||||
use aws_sdk_s3::{Client, Config as S3Config};
|
||||
use aws_smithy_http_client::Builder as SmithyHttpClientBuilder;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
@@ -133,6 +134,14 @@ impl S3Client {
|
||||
.region(Region::new(config.region.clone()))
|
||||
.behavior_version(aws_sdk_s3::config::BehaviorVersion::latest());
|
||||
|
||||
if config
|
||||
.endpoint_url
|
||||
.as_deref()
|
||||
.is_some_and(|endpoint| endpoint.starts_with("http://"))
|
||||
{
|
||||
config_builder = config_builder.http_client(SmithyHttpClientBuilder::new().build_http());
|
||||
}
|
||||
|
||||
// Set force path style if custom endpoint or explicitly requested
|
||||
let should_force_path_style = config.endpoint_url.is_some() || config.force_path_style;
|
||||
if should_force_path_style {
|
||||
|
||||
@@ -629,6 +629,8 @@ mod tests {
|
||||
let config = Config {
|
||||
access_key_id: Some("test_key".to_string()),
|
||||
secret_access_key: Some("test_secret".to_string()),
|
||||
endpoint_url: Some("http://127.0.0.1:9000".to_string()),
|
||||
force_path_style: true,
|
||||
..Config::default()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user