Ktor HttpClient (native/curl): json deserialization doesn't work when using a proxy
See original GitHub issueKtor Version and Engine Used (client or server and name)
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.61'
}
...
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "org.jetbrains.kotlinx:kotlinx-io:0.1.16"
implementation "io.ktor:ktor-client-core:1.3.0-rc2"
implementation "io.ktor:ktor-client-json:1.3.0-rc2"
implementation "io.ktor:ktor-client-serialization:1.3.0-rc2"
implementation("io.ktor:ktor-client-logging:1.3.0-rc2")
}
}
...
macosMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-io-native:0.1.16"
implementation "io.ktor:ktor-client-serialization-native:1.3.0-rc2"
implementation "io.ktor:ktor-client-json-native:1.3.0-rc2"
implementation "io.ktor:ktor-client-curl:1.3.0-rc2"
implementation("io.ktor:ktor-client-logging-native:1.3.0-rc2")
}
}
Describe the bug When using a proxy (
engine {
proxy = ProxyBuilder.http(URLBuilder().apply {
host = "localhost"
port = 8888
}.build())
}
), on the JVM, everything works fine.
But on native, serialization breaks, I get
Uncaught Kotlin exception: io.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteChannelNative -> class org.jraf.klibqonto.internal.api.model.organizations.ApiOrganizationEnvelope
To Reproduce Steps to reproduce the behavior: Use Ktor HttpClient with json serialization on native (in my case, MacOS) and configure a proxy, and run it. The above exception is thrown.
Expected behavior Serialization should work with a proxy.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Content negotiation and serialization | Ktor
Negotiating media types between the client and server. For this, it uses the Accept and Content-Type headers. Serializing/deserializing the ...
Read more >Issue With Deserialization Json Array with Ktor - Stack Overflow
Given that I am trying to pull a JsonArray from the URL, I thought using List<PostResponse> would work to let kotlinx serialization know...
Read more >CHANGELOG.md · Gitee 极速下载/Ktor - Gitee.com
Introduce DoubleReceive feature that makes it work. Server CORS support fixed and improved; Added initial kotlinx.serialization support for ...
Read more >Client request invalid: 406 Not Acceptable : KTOR-357
It should deserialize the json response into an object. Without JSON feature, the request works fine and is producing the JSON as output....
Read more >io.ktor:ktor-client-json: Versions | Openbase
Fix deserialization issue in client (Fix #1800). GitHub issue/pr links in IDEA Git log (#1806); Fix log channel is not closed for ByteArrayContent...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@BoD thank you, I’ve reproduced it. Please follow the new issue KTOR-955 I’ve created in Youtrack.
Fixed in 1.4.2