Vivek Modi
03/01/2022, 3:51 PMNathan Kleinschmidt
03/01/2022, 9:50 PMСтефан Јовановић
03/02/2022, 11:44 AMjava.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
After trying to make a request to this endpoint:
post("/home") {
call.sessions.set(UserSession(id = "123", name = "Name"))
call.respondRedirect(Endpoint.Authorized.path)
}
I'm using 2.0.0-beta-1 version.Brais Gabin
03/02/2022, 4:47 PMHttpResponse
? I would like to use it to test a function that receives an HttpResponse
and returns a Result
. I know that I could use MockEngine
to create a HttpResponse
but it feels too much. I'm assuming that HttpResponse
is something similar as Response
in Retrofit
. And there I could use Response.error()
or Response.success()
to create fakes.dany giguere
03/02/2022, 10:29 PMHayden Meloche
03/03/2022, 2:35 AMJ Man
03/03/2022, 6:48 AMJoakim Forslund
03/03/2022, 8:45 AMTomas Kormanak
03/03/2022, 10:40 AMade
03/03/2022, 12:12 PMhumblehacker
03/03/2022, 7:27 PMdany giguere
03/03/2022, 10:04 PMapp.demo:test: Could not find com.github.aymanizz:ktor-i18n:1.0.0.
benkuly
03/04/2022, 3:09 PMtestApplication
to test ktor client stuff, because I really don't like the ktor client mock api and with testApplication
I can re-use type safe routes (@Resource
). The problem is, that testApplication
is only available for jvm and native and so I cant't test the client code on other platforms.Barry Fawthrop
03/04/2022, 7:11 PMEnrico Saggiorato
03/05/2022, 10:52 AMBarry Fawthrop
03/06/2022, 6:59 PMarnaud.giuliani
03/07/2022, 5:33 PMmartmists
03/08/2022, 5:50 PMjmfayard
03/09/2022, 10:14 AMKtor 2
from an EAP version to 2.0.0-beta-1
The EAP version was available at https://maven.pkg.jetbrains.space/public/p/ktor/eap/io/ktor/
but that doesn't seem to be the case of the beta version
nor is it published on mavenCentral()
Am I missing something?ade
03/09/2022, 3:26 PMadjpd
03/09/2022, 6:30 PM1.6.7
to 2.0.0
because 1.6.7
doesn't work on iosArm64
. Now I get this error: Could not find org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20-M1-106 Required by: project: shared.
Any ideas?Bridgette Powell
03/09/2022, 11:18 PMio.ktor.server.application.call
and io.ktor.server.response.respondText
? What is it about the call
property that requires both imports?
I would have thought just importing io.ktor.server.application.call
is enough. Then calling call.respondText()
is ok, but I get an Unresolved Reference error if I dont include the other import.
package com.mobilecoin.plugins
import io.ktor.server.application.Application
import io.ktor.server.application.call
import io.ktor.server.response.respondText
import io.ktor.server.routing.get
import io.ktor.server.routing.routing
fun Application.configureRouting() {
// Starting point for a Ktor app:
routing {
get("/") {
call.respondText("Hello World!")
}
}
routing {
}
}
Thanks!Werner Guttmann
03/10/2022, 1:43 PMansman
03/10/2022, 4:02 PMwithTestApplication({ module(config) }) {
assertEquals(
HttpStatusCode.Unauthorized,
handleWebSocket("/some/path") {
addHeader(HttpHeaders.Authorization, "Bearer invalid")
}.response.status()
)
}
jozefdransfield
03/10/2022, 11:03 PMwebSocket("/receive/{channel}") {
val messageFlow: Flow<String> = callbackFlow {
val jedis = jedisPool.resource
jedis.subscribe(object : JedisPubSub() {
override fun onMessage(channel: String, message: String) {
trySendBlocking(message)
}
}, channel)
awaitClose {
jedis.close()
}
}
messageFlow.cancellable().collect { message ->
send(message)
}
print("Websocket closed")
}
The issue is when the client closes the socket i never see the Websocket closed message, I presume the messageFlow isnt being cancelled? Is there a solution to this?Lucas León
03/11/2022, 3:05 AMAndrew Reed
03/11/2022, 11:42 AMbut was io.ktor.client.call.NoTransformationFoundException: No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class com.a.mp.networking.TestData
So sending a request asking for a json object response but then i tell my test engine client to respond with a 404 error, but instead it seems to be trying to serialise the 404 error.Wietlol
03/12/2022, 11:14 AMexpected: 11852
actual: 11850
average: 118.5
min: 105
max: 128
running similar code in Java (using a different http client though) results in the following
expected: 94
actual: 74
average: 0.74
min: 0
max: 25
How can I figure out where this overhead comes from?
And how can I solve it?GoldenCow
03/14/2022, 8:00 AMsuspend fun addShoppingListItem(shoppingListItem: ShoppingListItem) {
<http://jsonClient.post|jsonClient.post><Unit>(endpoint + ShoppingListItem.path) {
contentType(ContentType.Application.Json)
body = shoppingListItem
}
}
This is what the server does when it receives a POST request:
post {
collection.insertOne(call.receive<ShoppingListItem>())
call.respond(HttpStatusCode.OK)
}
but this is what I get every time I perform a POST request through my browser.
Are there any help or docs I might be able to benefit from?FunkyMuse
03/14/2022, 5:05 PMFunkyMuse
03/14/2022, 5:05 PMBig Chungus
03/14/2022, 8:24 PMFunkyMuse
03/14/2022, 10:33 PMBig Chungus
03/14/2022, 11:13 PMFunkyMuse
03/15/2022, 10:06 PM