Patrick Jackson
07/18/2019, 2:45 PMAlexander
07/19/2019, 10:45 AMsuspend
functions? At the moment I cannot use synchronization primitives (channels, mutexes) inside them.bitkid
07/19/2019, 11:05 AMRodrigo Silva
07/19/2019, 11:08 PMJonas Ørting
07/20/2019, 5:50 PMcarrot
07/21/2019, 10:31 PMbitkid
07/22/2019, 8:22 AMRobin Larsen
07/22/2019, 6:20 PMnet::ERR_INVALID_CHUNKED_ENCODING 200 (200)
both in Chrome and Firefox. All other endpoints not using the templates work fine (JSON, plain text)
I have other apps running just fine on the same server using Thymeleaf, although the apps are made with SpringBoot.
Any ideas?max.denissov
07/23/2019, 6:13 AMdata User(name: String)
Response from server with a wrapper:
Success response:
{
"data": {
"name": "Mark Watney"
},
"error": null
}
Business error respose:
{
"data": null
"error": { ... }
}
In android I can use something like an interceptor or an adapter in library like Retrofit, but what about ktor-client?Nikolai
07/23/2019, 3:48 PMHamza
07/24/2019, 11:05 AMPOST <http://localhost:1296/search> 415 (Unsupported Media Type)
Alexander Potukar
07/24/2019, 1:04 PMSergioedcigreja
07/24/2019, 1:49 PMSlackbot
07/24/2019, 1:58 PMrahulrav
07/25/2019, 12:11 PMresources
handler. For some reason I don’t see the correct response headers. What am I doing wrong ?
https://github.com/tikurahul/rahulrav-com/blob/master/src/main/kotlin/com/rahulrav/Application.kt#L47
https://github.com/tikurahul/rahulrav-com/blob/master/src/main/kotlin/com/rahulrav/RequestHandlers.kt#L25sonofblip
07/25/2019, 3:06 PMHamza
07/25/2019, 4:10 PMget("/{*}") {
call.respond("hello")
}
didn't work for /
and /{anything}/{something}
sonofblip
07/25/2019, 6:43 PM@KtorExperimentalLocationsAPI
or @KtorExperimentalAPI
over everything in order to remove IntelliJ warnings.Sergioedcigreja
07/26/2019, 10:52 AMFail
07/26/2019, 2:27 PMexpectSuccess = false
not working at 1.2.2? On Ktor multiplatform I catch Platform exception
I tried the following options:
HttpClient {
expectSuccess = false
and
HttpClient {
HttpResponseValidator {
validateResponse {response ->
if (response.status.value!=200) {
throw ResponseException(response)
}
}
}
And ResponseException
not catched. Only Exception
not Solved 😞spierce7
07/27/2019, 10:17 PMstatic
block for some image requests (i.e. /favicon-32x32.png
) aren't found and get returned with the redirect, but when I comment out the redirectUnknown
function, it works fine. It's odd because my static
block is placed before redirectUnknown
. Does anyone know of a better way to do this?
fun Route.redirectUnknown() {
// Unknown path - redirect back to main site
get("*") {
val domain = call.request.domain()
val port: String = run {
val port = call.request.port()
if (port == 80 || port == 443) "" else ":$port"
}
val redirectUrl: String = if (BuildUtil.isDev) {
val scheme = call.request.origin.scheme
if (domain.value == "localhost" || domain.isIpAddress()) {
"$scheme://$domain$port/"
} else {
"$<scheme://www>.$domain$port/"
}
} else {
"<https://www>.$domain$port/"
}
call.respondRedirect(redirectUrl)
}
}
Dominaezzz
07/29/2019, 9:55 AMval response = client.get<HttpResponse>(....)
, do I also have to do response.close()
? Can't find docs and the samples don't give an indication.spierce7
07/29/2019, 8:40 PMwww
, and redirect to the <https://www>.
version of my site - what would be the best way to do that?Bino
07/30/2019, 8:54 AMdns-sd
or zeroconf/bonjour
into ktor?
I would like to announce the ktor service in a local network without setting the ip/host on the client.Thomas
07/30/2019, 6:58 PMResponseException
is not serializable, it throws a NotSerializableException
. This is because of the response
field. Can this be changed so it is serializable? https://github.com/ktorio/ktor/blob/178479ba392524d37193fcf2f6b30f570a0a3ba7/ktor-client/ktor-client-core/common/src/io/ktor/client/features/DefaultResponseValidation.kt#L51Robert Menke
07/31/2019, 12:14 AMresponse.close()
caused one of our servers to run out of memory today @Dominaezzz. Just fixed it and fortunately had no downtime because ECS is pretty nice 🙂.Melih Aksoy
07/31/2019, 11:20 AMsourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializer_version"
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-json:$ktor_version"
}
}
androidMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializer_version"
implementation "io.ktor:ktor-client-android:$ktor_version"
implementation "io.ktor:ktor-client-json-jvm:$ktor_version"
}
}
iosMain {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serializer_version"
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-json-native:$ktor_version"
}
}
}
I’m having trouble with keeping client in common. If I use client in common module as just an HttpClient()
, without features, I’m getting class cast exception as in https://github.com/ktorio/ktor/issues/997.
Defining content type does not solve it, but I can add JsonFeature
to my client. This ends up crashing in Android tho:
Caused by: java.lang.IllegalStateException: Fail to find serializer. Consider to add one of the following dependencies:
- ktor-client-gson
- ktor-client-json // <- Oh well, it's actually there isn't it ?
- ktor-client-serialization
As seen above in dependencies, I’m including io.ktor:ktor-client-json
in common, but it does not contain any serializer that I can assign in
install(JsonFeature) {
serializer = ????
}
block. If I define serializer as expect
and try to implement actual
for Android, it’s fine, but again, I can’t find any for iOS implmentation ( io.ktor:ktor-client-json-native
).
What is the right way to do this by using kotlinx.serialization
for both platforms ?Big Chungus
08/01/2019, 3:38 PMcy
08/01/2019, 6:33 PM1.2.3
has been published
* JS websocket bugs fixes and improvements
* Eliminated Java9's Base64 implementation (useful for older JDK and Android)
* Fixed bug of adding unexpected trailing slash (#1201) (#1206)
* Improved apache and okhttp client engines performance
* Fixed client response body cancellation
* Added client response streaming on nodejs
* Deprecated old client BasicAuth
* Introduced a flag to send auth without negotiation
* Added server kotlinx.serialization initial support (SerializationConverter
)
* Client TLS implementation fixes: cancellation and error handling.
* Added web assembly content type.
* Prohibited server double request content call.receive
.
* Introduce DoubleReceive
feature that makes it work.
* Server CORS support fixed and improved
* Added initial kotlinx.serialization support for server including receiving generic collections.
* Introduced ktor-bom
for better dependency management.
* Improved jetty server engine configuration to enable manual connectors setup.
* Fixed client memory leak (#1223).
* Upgraded Jetty, Netty and utility libraries.
* Kotlin 1.3.41
⚠️ Breaking changes/Migration steps:
* CORS doesn’t allow non-simple request body content types anymore by default
* to allow extra content types such as json, enable allowNonSimpleContentTypes
* At least Kotlin 1.3.41 IS REQUIREDandrew
08/01/2019, 9:54 PM