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
8 changes: 8 additions & 0 deletions .changes/1695ebf6-1351-4555-8ab9-d90c91622549.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "1695ebf6-1351-4555-8ab9-d90c91622549",
"type": "feature",
"description": "Add `writeChunk` method to HttpStream",
"issues": [
"https://github.com/awslabs/smithy-kotlin/issues/759"
]
}
7 changes: 7 additions & 0 deletions src/common/src/aws/sdk/kotlin/crt/http/HttpStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ public interface HttpStream : Closeable {
* Activate the client stream and start processing the request
*/
public fun activate()

/**
* Send a chunk of data. You must call activate() before using this function.
* @param chunkData the chunk of data to send. this should be already formatted in the chunked transfer encoding.
* @param isFinalChunk represents if the chunk of data is the final chunk. if set to true, this will terminate the request stream.
*/
public fun writeChunk(chunkData: ByteArray, isFinalChunk: Boolean)
}
4 changes: 4 additions & 0 deletions src/jvm/src/aws/sdk/kotlin/crt/http/HttpStreamJVM.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ internal class HttpStreamJVM(private val jniStream: HttpStreamJni) : HttpStream
override fun activate() = jniStream.activate()

override fun close() = jniStream.close()

override fun writeChunk(chunkData: ByteArray, isFinalChunk: Boolean) {
jniStream.writeChunk(chunkData, isFinalChunk)
}
}