Skip to content

Commit

Permalink
Replace encodeToByteArray with toByteArray
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis committed Oct 17, 2023
1 parent 9083332 commit bfeef33
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FlexibleChecksumsRequestInterceptorTest {
fun itSetsChecksumHeader() = runTest {
checksums.forEach { (checksumAlgorithmName, expectedChecksumValue) ->
val req = HttpRequestBuilder().apply {
body = HttpBody.fromBytes("<Foo>bar</Foo>".encodeToByteArray())
body = HttpBody.fromBytes("<Foo>bar</Foo>".toByteArray())
}

val op = newTestOperation<Unit, Unit>(req, Unit)
Expand All @@ -55,7 +55,7 @@ class FlexibleChecksumsRequestInterceptorTest {
@Test
fun itAllowsOnlyOneChecksumHeader() = runTest {
val req = HttpRequestBuilder().apply {
body = HttpBody.fromBytes("<Foo>bar</Foo>".encodeToByteArray())
body = HttpBody.fromBytes("<Foo>bar</Foo>".toByteArray())
}
req.headers { append("x-amz-checksum-sha256", "sha256-checksum-value") }
req.headers { append("x-amz-checksum-crc32", "crc32-checksum-value") }
Expand All @@ -80,7 +80,7 @@ class FlexibleChecksumsRequestInterceptorTest {
@Test
fun itThrowsOnUnsupportedChecksumAlgorithm() = runTest {
val req = HttpRequestBuilder().apply {
body = HttpBody.fromBytes("<Foo>bar</Foo>".encodeToByteArray())
body = HttpBody.fromBytes("<Foo>bar</Foo>".toByteArray())
}

val unsupportedChecksumAlgorithmName = "fooblefabble1024"
Expand All @@ -103,7 +103,7 @@ class FlexibleChecksumsRequestInterceptorTest {
val req = HttpRequestBuilder().apply {
body = object : HttpBody.SourceContent() {
override val contentLength: Long = 1024 * 1024 * 128
override fun readFrom(): SdkSource = "a".repeat(contentLength.toInt()).encodeToByteArray().source()
override fun readFrom(): SdkSource = "a".repeat(contentLength.toInt()).toByteArray().source()
override val isOneShot: Boolean get() = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ inline fun <reified I> newTestOperation(serialized: HttpRequestBuilder): SdkHttp

class FlexibleChecksumsResponseInterceptorTest {

private val response = "abc".repeat(1024).encodeToByteArray()
private val response = "abc".repeat(1024).toByteArray()

private val checksums: List<Pair<String, String>> = listOf(
"crc32c" to "wS3hug==",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object ResponseLengthValidationTestInput
data class ResponseLengthValidationTestOutput(val body: HttpBody)

private const val CONTENT_LENGTH_HEADER_NAME = "Content-Length"
private val RESPONSE = "a".repeat(500).encodeToByteArray()
private val RESPONSE = "a".repeat(500).toByteArray()

fun op() =
SdkHttpOperation.build {
Expand Down

0 comments on commit bfeef33

Please sign in to comment.