-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KTOR-5518 Fix Exception type for OkHttp channel adapter (#3394)
* KTOR-5518 Make StreamRequestBody throwing only IOException * KTOR-5518 Keep origin exception type when request is cancelled
- Loading branch information
Showing
4 changed files
with
51 additions
and
2 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
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
22 changes: 22 additions & 0 deletions
22
...-client/ktor-client-okhttp/jvm/test/io/ktor/client/engine/okhttp/StreamRequestBodyTest.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 @@ | ||
/* | ||
* Copyright 2014-2023 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package io.ktor.client.engine.okhttp | ||
|
||
import okio.* | ||
import kotlin.test.* | ||
|
||
class StreamRequestBodyTest { | ||
|
||
@Test | ||
fun testChannelThrowException() { | ||
val body = StreamRequestBody(0) { | ||
error("Can't read body") | ||
} | ||
|
||
assertFailsWith<IOException> { | ||
body.writeTo(Buffer()) | ||
} | ||
} | ||
} |