John O'Reilly
11/02/2021, 5:19 PM1.6.0-RC
Kotlin version and when I run app (on iOS) now I'm getting
Failed to find HttpClientEngineContainer. Consider adding [HttpClientEngine] implementation in dependencies.
I have io.ktor:ktor-client-ios
dependency (as before). https://kotlinlang.org/docs/eap.html#build-details seems to indicate that version should work with Ktor 1.6.4hhariri
11/02/2021, 6:24 PMWilliam Persall
11/02/2021, 10:06 PMTomasz Krakowiak
11/02/2021, 11:29 PMMarko Kunic
11/03/2021, 4:34 PMrunBlocking
but still not sure how to get the response outside of it?yogurtearl
11/03/2021, 6:20 PMMarko Kunic
11/04/2021, 9:32 AMType mismatch.
Required: HeaderValueWithParameters
Found: String
HeaderValueWithParameters is abstract, not sure what to pass here?Jeff Lockhart
11/05/2021, 10:18 PMHttpClient
and an Authenticator
class I'd like to install in the client. In an effort to beautify the code, I'm trying to make the syntax concise. I'd like this to work:
class Api(authenticator: Authenticator) {
private val client = HttpClient {
Auth {
authenticator.install() // Unresolved reference: install
}
}
//...
}
class Authenticator(
private val dependency: Dependency
) {
fun Auth.install() {
bearer {
//...
}
}
}
But get "Unresolved reference: install" error. It's not able to call the install()
function with Auth
as the receiver.
If I change authenticator.install()
to with(authenticator) { install() }
or authenticator.run { install() }
, this works, but obviously not as nice. Authenticator
has dependencies, which is why the class is necessary and can't be a simple extension function. Is there a better way to format this code to achieve what I'm trying to do as concisely as possible?Marcin Wisniowski
11/07/2021, 12:55 AMApplicationCall.respond()
taking up to 10 seconds in some situations, how could I debug that, or what could be possible causes to look into?coroutinedispatcher
11/07/2021, 2:16 PMRak
11/07/2021, 2:21 PMKamo Spertsyan
11/08/2021, 8:33 AMhsyogesh
11/08/2021, 9:19 AMaltavir
11/08/2021, 9:51 AMMarcelus Trojahn
11/08/2021, 11:01 PMMarcello Galhardo
11/10/2021, 2:26 PMTimur Atakishiev
11/11/2021, 8:23 AMAlex Styl
11/11/2021, 8:55 AMArnab
11/11/2021, 1:09 PMFoo
that has Bar
and Baz
as subclasses, and I make a post request that can either create a Bar
or a Baz
, how can I do that? Do I say <http://myClient.post|myClient.post><Foo> { … }
and then process the entity as either Bar
or Baz
?Joost Klitsie
11/11/2021, 3:52 PMCristian Rosa
11/11/2021, 4:14 PMFailed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: javax/naming/NamingException
The weird thing is if I run the app throw the IDE or with a jar by command line no error and everything works as expected
the module where I got the error is a pretty simple ktor server (with some client part to talk to a master-server)
a very simple views written in composeAngad
11/11/2021, 6:36 PMkotlin.native.internal.GC.collect()
when screens are getting closed) the leaks exist. I'm sharing screenshots for some of the memory leaks. Has anyone else seen these kind of leaks before?Philip Dukhov
11/12/2021, 5:15 AM// server
route("user") {
post("setFavorite") {
}
}
route("auth") {
post("facebook") {
}
}
route("other") {
}
// client
<http://client.post|client.post><Unit>("/user/setFavorite")
I'd like to share this names to prevent errors. For example with interface like this:
sealed interface ServerRoutes {
sealed interface User: ServerRoutes {
object SetFavorite: User
}
sealed interface Auth: ServerRoutes {
object Facebook: Auth
}
object Other: ServerRoutes
}
Which could be used like this:
// server
route(ServerRoutes.User) {
post(ServerRoutes.User.SetFavorite) {
}
}
route(ServerRoutes.Auth) {
post(ServerRoutes.Auth.Facebook) {
}
}
route(ServerRoutes.Other) {
}
// client
<http://client.post|client.post><Unit>(ServerRoutes.User.SetFavorite)
I think I can generate routes from class names using annotation processor, but I'm wondering if there's some existing solution?Paul Woitaschek
11/12/2021, 8:10 AMLukasz Kalnik
11/13/2021, 6:25 PMinternal fun createHttpClient() = HttpClient {
install(Logging) {
logger = Logger.DEFAULT
level = LogLevel.ALL
}
}
but I see no logs.
On Android I use the CIO client.Justin
11/13/2021, 7:23 PMktor-server-core
and ktor-server-cio
exist in maven (e.g. https://maven.pkg.jetbrains.space/public/p/ktor/eap/io/ktor/ktor-server-core-macosarm64/) but I can't seem to figure out how to configure my build.gradle.kts to get the right dependencies (a lot of dependency could not be found errors regardless of which version of the EAP I target).nordiauwu
11/13/2021, 7:55 PMfun main() {
val file = File("G:/test.zip")
embeddedServer(CIO, port = 8081) {
routing {
get("/file") {
call.response.header(HttpHeaders.ContentDisposition, "inline; filename=\"test.zip\"")
call.respondOutputStream {
file.inputStream().buffered().use { stream -> stream.copyTo(this.buffered()) }
}
}
}
}.start(true)
}
So what is a good way to debug it? Or maybe there is a better approach I can use?Gabi
11/14/2021, 12:08 AMJavier
11/15/2021, 11:24 PMsaket
11/16/2021, 3:33 AMsaket
11/16/2021, 3:33 AMESchouten
11/16/2021, 6:20 AMsaket
11/16/2021, 6:23 AMESchouten
11/16/2021, 6:33 AM