forked from MarathonLabs/marathon
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ByteArrayContent instead of WriteChannelContent when executing HTTP PUT requests
- Loading branch information
Ivan Dyatlov
committed
Jul 9, 2024
1 parent
7fa3a0a
commit ceb94fd
Showing
5 changed files
with
48 additions
and
44 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
core/src/main/kotlin/com/malinskiy/marathon/cache/CacheEntryWriter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.malinskiy.marathon.cache | ||
|
||
import io.ktor.utils.io.* | ||
import java.io.OutputStream | ||
|
||
interface CacheEntryWriter { | ||
suspend fun writeTo(output: ByteWriteChannel) | ||
fun writeTo(output: OutputStream) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
core/src/test/kotlin/com/malinskiy/marathon/cache/SimpleEntryWriter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package com.malinskiy.marathon.cache | ||
|
||
import io.ktor.utils.io.* | ||
import java.io.OutputStream | ||
|
||
class SimpleEntryWriter(data: String) : CacheEntryWriter { | ||
|
||
private val bytes = data.toByteArray() | ||
|
||
override suspend fun writeTo(output: ByteWriteChannel) { | ||
output.writeFully(bytes) | ||
override fun writeTo(output: OutputStream) { | ||
output.write(bytes) | ||
} | ||
|
||
} |