buszi0809
08/19/2025, 7:45 AMsuspend
in the Default Request plugin? I want to add some header to the request from a local storage, and the query to that storage is based on coroutines. Thought Ktor as the superior client would handle that easily. To my suprise this won't compile because the builder is missing the suspend
modifier. Why is that?
install(DefaultRequest) {
header("some key", someRepo.getValue())
}
Where someRepo.getValue()
is suspend function.
Based on implementation of Default Request plugin I've managed to create such a bypass for that when building the HttpClient:
.apply {
requestPipeline.intercept(HttpRequestPipeline.Before) {
header("some key", someRepo.getValue())
}
}
buszi0809
08/19/2025, 8:29 AM