Empty body in response using macosx64 target
See original GitHub issueKtor Version and Engine Used (client or server and name) 1.3.0, client (macosx64) (using curl)
Describe the bug When using macosx64 target in a Multiplatform project I’m getting empty BODY in response
HttpClient: REQUEST: http://api.open-notify.org/astros.json
HttpClient: METHOD: HttpMethod(value=GET)
HttpClient: COMMON HEADERS
HttpClient: -> Accept: application/json
HttpClient: -> Accept-Charset: UTF-8
HttpClient: CONTENT HEADERS
HttpClient: BODY Content-Type: null
HttpClient: BODY START
HttpClient: BODY END
The same code for iOS logs
HttpClient: REQUEST: http://api.open-notify.org/astros.json
HttpClient: METHOD: HttpMethod(value=GET)
HttpClient: COMMON HEADERS
HttpClient: -> Accept: application/json
HttpClient: -> Accept-Charset: UTF-8
HttpClient: CONTENT HEADERS
HttpClient: BODY Content-Type: null
HttpClient: BODY START
HttpClient: BODY END
HttpClient: BODY Content-Type: application/json
HttpClient: BODY START
HttpClient: {"people": [{"craft": "ISS", "name": "Andrew Morgan"}, {"craft": "ISS", "name": "Oleg Skripochka"}, {"craft": "ISS", "name": "Jessica Meir"}], "message": "success", "number": 3}
HttpClient: BODY END
The following is the common code that uses ktor
class PeopleInSpaceApi {
private val url = "http://api.open-notify.org/astros.json"
private val client by lazy {
HttpClient() {
install(JsonFeature) {
serializer = KotlinxSerializer(Json(JsonConfiguration(strictMode = false)))
}
install(Logging) {
logger = Logger.DEFAULT
level = LogLevel.ALL
}
}
}
suspend fun fetchPeople(): AstroResult {
return client.get(url)
}
}
I’m using following dependencies
macOSMain.dependencies {
// Coroutines
implementation('org.jetbrains.kotlinx:kotlinx-coroutines-core-macosx64') {
version {
strictly '1.3.3-native-mt'
}
}
// Ktor
implementation "io.ktor:ktor-client-curl:${Versions.ktor}"
implementation "io.ktor:ktor-client-core-macosx64:${Versions.ktor}"
implementation "io.ktor:ktor-client-json-macosx64:${Versions.ktor}"
implementation "io.ktor:ktor-client-logging-macosx64:${Versions.ktor}"
implementation "io.ktor:ktor-client-serialization-macosx64:${Versions.ktor}"
// Serialize
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-macosx64:${Versions.kotlinxSerialization}"
}
(kotlinxSerialization = “0.14.0”)
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (19 by maintainers)
Top Results From Across the Web
Does anyone know why the Response Body would be empty ...
This works perfectly in Android but IOS returns an empty POST response body. I used IOS Charles and can see the Response body...
Read more >CHANGELOG.md · Gitee 极速下载/Ktor - Gitee.com
OkHttp: Can't reuse same HttpRequestBuilder for different network clients (KTOR-949); Empty body in response using macosX64 target (KTOR-479) ...
Read more >WhatsNew 1.4 | Ktor Framework
ClassCastException with HTTP client when using via an inline function with reified type ... Empty body in response using macosx64 target.
Read more >io.ktor:ktor-client-serialization-macosx64: Versions | Openbase
Full version history for io.ktor:ktor-client-serialization-macosx64 including change logs. ... Empty body in response using macosX64 target (KTOR-479) ...
Read more >Solved: Re: Empty JSON string when getting target response...
Internal proxy override the Content-Type to have value "application/json" and keep the same JSON response body. External proxy receives response from internal ...
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
Fixed in
master
Hi @joreilly, it looks like you’re trying to use
native-mt
branch of coroutines, but release ktor is not compatible with it right now: it leads to unexpected freezes. Could you recheck it with the regular version?The process of migration to the
native-mt
version is in progress right now.