Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions generator/.DevConfigs/c49077d9-90b3-437f-b316-6d8d8833ae72.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Add ContentLanguage to header collection of GetObjectResponse."
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ private static void UnmarshallResult(XmlUnmarshallerContext context,GetObjectRes
response.Headers.ContentEncoding = S3Transforms.ToString(responseData.GetHeaderValue("Content-Encoding"));
if (responseData.IsHeaderPresent("Content-Language"))
response.ContentLanguage = S3Transforms.ToString(responseData.GetHeaderValue("Content-Language"));
response.Headers.ContentLanguage = S3Transforms.ToString(responseData.GetHeaderValue("Content-Language"));
if (responseData.IsHeaderPresent("Content-Length"))
response.Headers.ContentLength = long.Parse(responseData.GetHeaderValue("Content-Length"), CultureInfo.InvariantCulture);
if (responseData.IsHeaderPresent("x-amz-object-lock-legal-hold"))
Expand Down
45 changes: 45 additions & 0 deletions sdk/test/Services/S3/IntegrationTests/GetObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,50 @@ public void TestContentLanguageResponseHeaderOverride()
"Original ContentLanguage should still be stored when no override is specified");
}
}

[TestMethod]
[TestCategory("S3")]
public void TestContentLanguageHeadersCollection()
{
var key = "TestContentLanguageHeadersCollection";
var expectedLanguage = "de-DE";

// Put object with Content-Language header
var putRequest = new PutObjectRequest
{
BucketName = bucketName,
Key = key,
ContentBody = "Test content for Content-Language headers collection"
};
putRequest.Headers["Content-Language"] = expectedLanguage;

Client.PutObject(putRequest);

// Get object and verify both ContentLanguage properties are set
var response = Client.GetObject(new GetObjectRequest
{
BucketName = bucketName,
Key = key
});

using (response)
{
// Verify the direct ContentLanguage property
Assert.IsNotNull(response.ContentLanguage,
"ContentLanguage property should not be null");
Assert.AreEqual(expectedLanguage, response.ContentLanguage,
"ContentLanguage property should match the value set during PutObject");

// Verify the Headers.ContentLanguage property
Assert.IsNotNull(response.Headers.ContentLanguage,
"Headers.ContentLanguage property should not be null");
Assert.AreEqual(expectedLanguage, response.Headers.ContentLanguage,
"Headers.ContentLanguage property should match the value set during PutObject");

// Verify both properties have the same value
Assert.AreEqual(response.ContentLanguage, response.Headers.ContentLanguage,
"ContentLanguage and Headers.ContentLanguage should have the same value");
}
}
}
}