@@ -52,6 +52,7 @@ pub struct CreateMultipartUpload {
52
52
tags : Option < HashMap < String , String > > ,
53
53
retention : Option < Retention > ,
54
54
legal_hold : bool ,
55
+ content_type : Option < String > ,
55
56
}
56
57
57
58
impl CreateMultipartUpload {
@@ -108,6 +109,11 @@ impl CreateMultipartUpload {
108
109
self
109
110
}
110
111
112
+ pub fn content_type ( mut self , content_type : Option < String > ) -> Self {
113
+ self . content_type = content_type;
114
+ self
115
+ }
116
+
111
117
fn get_headers ( & self ) -> Result < Multimap , Error > {
112
118
object_write_args_headers (
113
119
self . extra_headers . as_ref ( ) ,
@@ -116,6 +122,7 @@ impl CreateMultipartUpload {
116
122
self . tags . as_ref ( ) ,
117
123
self . retention . as_ref ( ) ,
118
124
self . legal_hold ,
125
+ self . content_type . as_ref ( ) ,
119
126
)
120
127
}
121
128
@@ -376,6 +383,7 @@ pub struct UploadPart {
376
383
retention : Option < Retention > ,
377
384
legal_hold : bool ,
378
385
data : SegmentedBytes ,
386
+ content_type : Option < String > ,
379
387
380
388
// This is used only when this struct is used for PutObject.
381
389
user_metadata : Option < Multimap > ,
@@ -452,6 +460,7 @@ impl UploadPart {
452
460
self . tags . as_ref ( ) ,
453
461
self . retention . as_ref ( ) ,
454
462
self . legal_hold ,
463
+ self . content_type . as_ref ( ) ,
455
464
)
456
465
}
457
466
@@ -597,6 +606,7 @@ fn object_write_args_headers(
597
606
tags : Option < & HashMap < String , String > > ,
598
607
retention : Option < & Retention > ,
599
608
legal_hold : bool ,
609
+ content_type : Option < & String > ,
600
610
) -> Result < Multimap , Error > {
601
611
let mut map = Multimap :: new ( ) ;
602
612
@@ -662,7 +672,10 @@ fn object_write_args_headers(
662
672
if !map. contains_key ( "Content-Type" ) {
663
673
map. insert (
664
674
String :: from ( "Content-Type" ) ,
665
- String :: from ( "application/octet-stream" ) ,
675
+ match content_type {
676
+ Some ( content_type) => content_type. clone ( ) ,
677
+ None => String :: from ( "application/octet-stream" ) ,
678
+ } ,
666
679
) ;
667
680
}
668
681
@@ -686,7 +699,7 @@ pub struct PutObjectContent {
686
699
retention : Option < Retention > ,
687
700
legal_hold : bool ,
688
701
part_size : Size ,
689
- content_type : String ,
702
+ content_type : Option < String > ,
690
703
691
704
// source data
692
705
input_content : ObjectContent ,
@@ -713,7 +726,7 @@ impl PutObjectContent {
713
726
retention : None ,
714
727
legal_hold : false ,
715
728
part_size : Size :: Unknown ,
716
- content_type : String :: from ( "application/octet-stream" ) ,
729
+ content_type : None ,
717
730
content_stream : ContentStream :: empty ( ) ,
718
731
part_count : None ,
719
732
}
@@ -770,7 +783,7 @@ impl PutObjectContent {
770
783
}
771
784
772
785
pub fn content_type ( mut self , content_type : String ) -> Self {
773
- self . content_type = content_type;
786
+ self . content_type = Some ( content_type) ;
774
787
self
775
788
}
776
789
@@ -965,6 +978,7 @@ impl PutObjectContent {
965
978
part_number : None ,
966
979
upload_id : None ,
967
980
data,
981
+ content_type : self . content_type . clone ( ) ,
968
982
} )
969
983
}
970
984
@@ -990,6 +1004,7 @@ impl PutObjectContent {
990
1004
part_number : Some ( part_number) ,
991
1005
upload_id : Some ( upload_id. to_string ( ) ) ,
992
1006
data,
1007
+ content_type : self . content_type . clone ( ) ,
993
1008
}
994
1009
}
995
1010
@@ -1023,6 +1038,7 @@ impl PutObjectContent {
1023
1038
tags : self . tags . clone ( ) ,
1024
1039
retention : self . retention . clone ( ) ,
1025
1040
legal_hold : self . legal_hold ,
1041
+ content_type : self . content_type . clone ( ) ,
1026
1042
}
1027
1043
}
1028
1044
}
0 commit comments