Skip to content

Commit f86a4e1

Browse files
authored
misc: add an E2E test setting Content-Length header on an aws-chunked request (#1257)
1 parent dc88b12 commit f86a4e1

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ coroutines-version = "1.7.3"
99
atomicfu-version = "0.23.1"
1010

1111
# smithy-kotlin codegen and runtime are versioned separately
12-
smithy-kotlin-runtime-version = "1.0.19"
13-
smithy-kotlin-codegen-version = "0.30.20"
12+
smithy-kotlin-runtime-version = "1.0.20"
13+
smithy-kotlin-codegen-version = "0.30.21"
1414

1515
# codegen
1616
smithy-version = "1.45.0"

services/s3/e2eTest/src/S3IntegrationTest.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ import aws.smithy.kotlin.runtime.content.asByteStream
1414
import aws.smithy.kotlin.runtime.content.decodeToString
1515
import aws.smithy.kotlin.runtime.content.fromFile
1616
import aws.smithy.kotlin.runtime.content.toByteArray
17+
import aws.smithy.kotlin.runtime.content.toByteStream
1718
import aws.smithy.kotlin.runtime.hashing.sha256
1819
import aws.smithy.kotlin.runtime.http.HttpException
1920
import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
2021
import aws.smithy.kotlin.runtime.http.request.HttpRequest
2122
import aws.smithy.kotlin.runtime.testing.RandomTempFile
2223
import aws.smithy.kotlin.runtime.text.encoding.encodeToHex
2324
import kotlinx.coroutines.*
25+
import kotlinx.coroutines.flow.flow
2426
import kotlinx.coroutines.flow.toList
2527
import org.junit.jupiter.api.AfterAll
2628
import org.junit.jupiter.api.BeforeAll
@@ -108,6 +110,20 @@ class S3BucketOpsIntegrationTest {
108110
assertEquals(contents, roundTrippedContents)
109111
}
110112

113+
@Test
114+
fun testPutObjectWithToByteStreamAndContentLength(): Unit = runBlocking {
115+
// See https://github.com/awslabs/aws-sdk-kotlin/issues/1249
116+
val keyName = "toByteStream-contentLength.txt"
117+
val arr = "Hello!".encodeToByteArray()
118+
119+
client.putObject {
120+
bucket = testBucket
121+
key = keyName
122+
body = flow { emit(arr) }.toByteStream(this@runBlocking, arr.size.toLong())
123+
contentLength = arr.size.toLong()
124+
}
125+
}
126+
111127
@Test
112128
fun testGetEmptyObject(): Unit = runBlocking {
113129
// See https://github.com/awslabs/aws-sdk-kotlin/issues/1014

0 commit comments

Comments
 (0)