File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
core/sdk-core/src/main/resources/software/amazon/awssdk/core/util
services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/handlers Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ application/font-tdpfr pfr
37
37
application/gml+xml gml
38
38
application/gpx+xml gpx
39
39
application/gxf gxf
40
+ application/gzip gz
41
+ application/gzip gzip
40
42
application/hyperstudio stk
41
43
application/inkml+xml ink inkml
42
44
application/ipfix ipfix
Original file line number Diff line number Diff line change @@ -84,6 +84,27 @@ public void putObjectFile_headerShouldContainContentType() throws IOException {
84
84
verify (putRequestedFor (anyUrl ()).withHeader (CONTENT_TYPE , equalTo ("text/html" )));
85
85
}
86
86
87
+ @ Test
88
+ public void putObject_gzipFile_hasProperContentType () throws IOException {
89
+ File file = new RandomTempFile ("test.gz" , 10 );
90
+ stubFor (any (urlMatching (".*" ))
91
+ .willReturn (response ()));
92
+ s3Client .putObject (putObjectRequest , RequestBody .fromFile (file ));
93
+ verify (putRequestedFor (anyUrl ()).withHeader (CONTENT_TYPE , equalTo ("application/gzip" )));
94
+ }
95
+
96
+ @ Test
97
+ public void putObject_gzipFile_shouldNotOverrideContentTypeInRequest () throws IOException {
98
+ File file = new RandomTempFile ("test.gz" , 10 );
99
+ String contentType = "something" ;
100
+ stubFor (any (urlMatching (".*" ))
101
+ .willReturn (response ()));
102
+
103
+ s3Client .putObject (putObjectRequest .toBuilder ().contentType (contentType ).build (),
104
+ RequestBody .fromFile (file ));
105
+ verify (putRequestedFor (anyUrl ()).withHeader (CONTENT_TYPE , equalTo (contentType )));
106
+ }
107
+
87
108
@ Test
88
109
public void putObjectUnknownFileExtension_contentTypeDefaultToBeStream () throws IOException {
89
110
File file = new RandomTempFile ("test.unknown" , 10 );
You can’t perform that action at this time.
0 commit comments