Skip to content

Commit 64a494b

Browse files
committed
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.
1 parent 9d3e68b commit 64a494b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

core/services/swift/src/backend.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ impl Builder for SwiftBuilder {
148148

149149
write: true,
150150
write_can_empty: true,
151+
write_with_content_type: true,
152+
write_with_content_disposition: true,
153+
write_with_content_encoding: true,
154+
write_with_cache_control: true,
151155
write_with_user_metadata: true,
152156

153157
delete: true,

core/services/swift/src/core.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ impl SwiftCore {
121121

122122
let mut req = Request::put(&url);
123123

124+
if let Some(content_type) = args.content_type() {
125+
req = req.header(header::CONTENT_TYPE, content_type);
126+
}
127+
if let Some(content_disposition) = args.content_disposition() {
128+
req = req.header(header::CONTENT_DISPOSITION, content_disposition);
129+
}
130+
if let Some(content_encoding) = args.content_encoding() {
131+
req = req.header(header::CONTENT_ENCODING, content_encoding);
132+
}
133+
if let Some(cache_control) = args.cache_control() {
134+
req = req.header(header::CACHE_CONTROL, cache_control);
135+
}
136+
124137
// Set user metadata headers.
125138
if let Some(user_metadata) = args.user_metadata() {
126139
for (k, v) in user_metadata {

0 commit comments

Comments
 (0)