diff --git a/services/s3/e2eTest/src/S3IntegrationTest.kt b/services/s3/e2eTest/src/S3IntegrationTest.kt index 051cc54f9cd..7e28e18b5fd 100644 --- a/services/s3/e2eTest/src/S3IntegrationTest.kt +++ b/services/s3/e2eTest/src/S3IntegrationTest.kt @@ -110,6 +110,25 @@ class S3BucketOpsIntegrationTest { assertEquals(contents, roundTrippedContents) } + @Test + fun testGetEmptyObject(): Unit = runBlocking { + // See https://github.com/awslabs/aws-sdk-kotlin/issues/1014 + val keyName = "get-empty-obj.txt" + + client.putObject { + bucket = testBucket + key = keyName + body = ByteStream.fromBytes(byteArrayOf()) + } + + val req = GetObjectRequest { + bucket = testBucket + key = keyName + } + val actualLength = client.getObject(req) { it.contentLength } + assertEquals(0, actualLength) + } + @Test fun testQueryParameterEncoding(): Unit = runBlocking { // see: https://github.com/awslabs/aws-sdk-kotlin/issues/448