@@ -87,6 +87,7 @@ namespace
8787 static std::string BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME = " largeeventstream" ;
8888 static std::string BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME = " errorsinevent" ;
8989 static std::string BASE_CHECKSUMS_BUCKET_NAME = " checksums" ;
90+ static std::string BASE_CONTENT_ENCODING_BUCKET_NAME = " contentencoding" ;
9091 static std::string BASE_CROSS_REGION_BUCKET_NAME = " crossregion" ;
9192 static std::string BASE_ENDPOINT_OVERRIDE_BUCKET_NAME = " endpointoverride" ;
9293 static const char * ALLOCATION_TAG = " BucketAndObjectOperationTest" ;
@@ -115,32 +116,31 @@ namespace
115116
116117 void EnsureUniqueBucketNames ()
117118 {
118- Aws::Vector<std::reference_wrapper<std::string>> TEST_BUCKETS =
119- {
120- std::ref (BASE_CREATE_BUCKET_TEST_NAME),
121- std::ref (BASE_DNS_UNFRIENDLY_TEST_NAME),
122- std::ref (BASE_LOCATION_BUCKET_TEST_NAME),
123- std::ref (BASE_OBJECTS_BUCKET_NAME),
124- std::ref (BASE_OBJECTS_NEWLINE_BUCKET_NAME),
125- std::ref (BASE_PUT_OBJECTS_BUCKET_NAME),
126- std::ref (BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME),
127- std::ref (BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME),
128- std::ref (BASE_PUT_MULTIPART_BUCKET_NAME),
129- std::ref (BASE_OBJECT_LOCK_BUCKET_NAME),
130- std::ref (BASE_ERRORS_TESTING_BUCKET),
131- std::ref (BASE_INTERRUPT_TESTING_BUCKET),
132- std::ref (BASE_EVENT_STREAM_TEST_BUCKET_NAME),
133- std::ref (BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME),
134- std::ref (BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME),
135- std::ref (BASE_CHECKSUMS_BUCKET_NAME),
136- std::ref (BASE_CROSS_REGION_BUCKET_NAME),
137- std::ref (BASE_ENDPOINT_OVERRIDE_BUCKET_NAME),
138- };
139-
140- for (auto & testBucketName : TEST_BUCKETS)
141- {
142- AppendUUID (testBucketName);
143- }
119+ Aws::Vector<std::reference_wrapper<std::string>> TEST_BUCKETS = {
120+ std::ref (BASE_CREATE_BUCKET_TEST_NAME),
121+ std::ref (BASE_DNS_UNFRIENDLY_TEST_NAME),
122+ std::ref (BASE_LOCATION_BUCKET_TEST_NAME),
123+ std::ref (BASE_OBJECTS_BUCKET_NAME),
124+ std::ref (BASE_OBJECTS_NEWLINE_BUCKET_NAME),
125+ std::ref (BASE_PUT_OBJECTS_BUCKET_NAME),
126+ std::ref (BASE_PUT_WEIRD_CHARSETS_OBJECTS_BUCKET_NAME),
127+ std::ref (BASE_PUT_OBJECTS_PRESIGNED_URLS_BUCKET_NAME),
128+ std::ref (BASE_PUT_MULTIPART_BUCKET_NAME),
129+ std::ref (BASE_OBJECT_LOCK_BUCKET_NAME),
130+ std::ref (BASE_ERRORS_TESTING_BUCKET),
131+ std::ref (BASE_INTERRUPT_TESTING_BUCKET),
132+ std::ref (BASE_EVENT_STREAM_TEST_BUCKET_NAME),
133+ std::ref (BASE_EVENT_STREAM_LARGE_FILE_TEST_BUCKET_NAME),
134+ std::ref (BASE_EVENT_STREAM_ERRORS_IN_EVENT_TEST_BUCKET_NAME),
135+ std::ref (BASE_CHECKSUMS_BUCKET_NAME),
136+ std::ref (BASE_CONTENT_ENCODING_BUCKET_NAME),
137+ std::ref (BASE_CROSS_REGION_BUCKET_NAME),
138+ std::ref (BASE_ENDPOINT_OVERRIDE_BUCKET_NAME),
139+ };
140+
141+ for (auto & testBucketName : TEST_BUCKETS) {
142+ AppendUUID (testBucketName);
143+ }
144144 }
145145
146146 class RetryFiveTimesRetryStrategy : public Aws ::Client::RetryStrategy
@@ -2552,4 +2552,32 @@ namespace
25522552 EXPECT_TRUE (response.IsSuccess ());
25532553 }
25542554 }
2555+
2556+ TEST_F (BucketAndObjectOperationTest, ContentEncodingShouldPersistOnChunkedRequest) {
2557+ const String fullBucketName = CalculateBucketName (BASE_CONTENT_ENCODING_BUCKET_NAME.c_str ());
2558+ SCOPED_TRACE (Aws::String (" FullBucketName " ) + fullBucketName);
2559+ CreateBucketRequest createBucketRequest;
2560+ createBucketRequest.SetBucket (fullBucketName);
2561+ createBucketRequest.SetACL (BucketCannedACL::private_);
2562+ CreateBucketOutcome createBucketOutcome = CreateBucket (createBucketRequest);
2563+ AWS_EXPECT_SUCCESS (createBucketOutcome);
2564+
2565+ auto request = PutObjectRequest ()
2566+ .WithBucket (fullBucketName)
2567+ .WithKey (" euchronia" )
2568+ .WithContentEncoding (" gzip" )
2569+ .WithChecksumAlgorithm (ChecksumAlgorithm::CRC32);
2570+
2571+ std::shared_ptr<Aws::IOStream> body =
2572+ Aws::MakeShared<Aws::StringStream>(ALLOCATION_TAG, " another day passes, and the age of a new king draws near" );
2573+
2574+ request.SetBody (body);
2575+
2576+ const auto putOutcome = Client->PutObject (request);
2577+ AWS_EXPECT_SUCCESS (putOutcome);
2578+
2579+ const auto headOutcome = Client->HeadObject (HeadObjectRequest ().WithBucket (fullBucketName).WithKey (" euchronia" ));
2580+ AWS_EXPECT_SUCCESS (headOutcome);
2581+ EXPECT_EQ (headOutcome.GetResult ().GetContentEncoding (), " gzip" );
2582+ }
25552583}
0 commit comments