-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: removed reset() call on HttpBotRequest's input stream
- Loading branch information
1 parent
3114023
commit 7ed4972
Showing
2 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
core/src/test/kotlin/com/justai/jaicf/core/test/channel/HttpBotRequestTest.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.justai.jaicf.core.test.channel | ||
|
||
import com.justai.jaicf.channel.http.HttpBotRequest | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.assertDoesNotThrow | ||
import kotlin.random.Random | ||
import kotlin.test.assertEquals | ||
|
||
class HttpBotRequestTest { | ||
@Test | ||
fun `should not throw exception on long request body`() { | ||
val randomBytes = Random.Default.nextBytes(65536) | ||
val request = HttpBotRequest(randomBytes.inputStream()) | ||
val resultString = assertDoesNotThrow { | ||
request.receiveText(charset = Charsets.UTF_8) | ||
} | ||
assertEquals( | ||
randomBytes.decodeToString(), | ||
resultString | ||
) | ||
} | ||
} |