This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new b07e46ad5 fix(services/swift): forward write headers to Swift API 
(#7206)
b07e46ad5 is described below

commit b07e46ad58aacb958c76013cd18471347836e485
Author: Ben Roeder <[email protected]>
AuthorDate: Sun Feb 22 16:48:04 2026 -0800

    fix(services/swift): forward write headers to Swift API (#7206)
    
    feat(services/swift): add Content-Type, Content-Disposition, 
Content-Encoding, Cache-Control on write
    
    Forward standard HTTP headers from OpWrite args to Swift PUT requests.
---
 core/services/swift/src/backend.rs |  4 ++++
 core/services/swift/src/core.rs    | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/core/services/swift/src/backend.rs 
b/core/services/swift/src/backend.rs
index 1cca5538b..088e54abd 100644
--- a/core/services/swift/src/backend.rs
+++ b/core/services/swift/src/backend.rs
@@ -148,6 +148,10 @@ impl Builder for SwiftBuilder {
 
                             write: true,
                             write_can_empty: true,
+                            write_with_content_type: true,
+                            write_with_content_disposition: true,
+                            write_with_content_encoding: true,
+                            write_with_cache_control: true,
                             write_with_user_metadata: true,
 
                             delete: true,
diff --git a/core/services/swift/src/core.rs b/core/services/swift/src/core.rs
index df521fcf2..ef837f531 100644
--- a/core/services/swift/src/core.rs
+++ b/core/services/swift/src/core.rs
@@ -121,6 +121,19 @@ impl SwiftCore {
 
         let mut req = Request::put(&url);
 
+        if let Some(content_type) = args.content_type() {
+            req = req.header(header::CONTENT_TYPE, content_type);
+        }
+        if let Some(content_disposition) = args.content_disposition() {
+            req = req.header(header::CONTENT_DISPOSITION, content_disposition);
+        }
+        if let Some(content_encoding) = args.content_encoding() {
+            req = req.header(header::CONTENT_ENCODING, content_encoding);
+        }
+        if let Some(cache_control) = args.cache_control() {
+            req = req.header(header::CACHE_CONTROL, cache_control);
+        }
+
         // Set user metadata headers.
         if let Some(user_metadata) = args.user_metadata() {
             for (k, v) in user_metadata {

Reply via email to