Derek Seroky
02/01/2019, 4:11 PMninrod
02/01/2019, 11:51 PMSzymon Tosik
02/03/2019, 3:28 PMJoakimForslund
02/05/2019, 9:35 AMDavide Giuseppe Farella
02/05/2019, 10:20 AMMore than one file was found with OS independent path 'META-INF/ktor-http.kotlin_module'
galex
02/06/2019, 9:38 AMKenneth
02/06/2019, 9:52 PMjava.lang.IllegalArgumentException: Couldn't instantiate type class Session for parameters [value]
whenever I call an endpoint.nestserau
02/07/2019, 2:11 PMinput
gets less than intended, in other words I don’t get the data in its entirety. Via Wireshark I’ve verified that the problem is not on the backend side, I always receive the same amount of bytes via the network interface and the bytes are also the same. But in 1-10% of cases input
is shorter than intended.
private val client = HttpClient()
suspend fun <T> send(...): ... {
val response: HttpResponse
try {
response = <http://client.post|client.post>(url) { body = payload }
} catch (e: Throwable) {
...
}
if (response.status != HttpStatusCode.OK) {
return ...
}
val input = response.readBytes().asUByteArray()
...
}
Thoughts?napperley
02/08/2019, 12:33 AMRiccardo Montagnin
02/08/2019, 10:53 AMInvalidDefinitionException - (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
I'm installing the feature as follows:
install(ContentNegotiation) {
jackson {
// Set how the dates should be handled
dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").apply {
timeZone = TimeZone.getTimeZone("UTC")
}
// Do not serialize null values
setSerializationInclusion(JsonInclude.Include.NON_NULL)
// Do not worry about unknown properties, ignoring them
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
// If we receive an empty object, treat it as null
enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)
//accept also lowercase value in enum fields
enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS)
}
}
Every time I do something like call.receive<MyClass>()
I get that error. How could I resolve the issue?Charlie
02/08/2019, 4:58 PMAlan Pierri
02/08/2019, 6:21 PMlateinit var foo: Foo
fun Application.main() {
if(!::foo.isInitialized){
// Initialize foo, which is heavy processing...
}
// More code...
}
Is there any way I can avoid re-initializing foo with Autoreload?
I hoped the initialization check would work, but it won't.napperley
02/08/2019, 10:27 PMfrellan
02/09/2019, 4:25 PMlaunch
returned immediatly and ran whatever was inside on a new thread.
launch {
doStuff()
}
call.respond(Created)
frellan
02/09/2019, 9:56 PMbasic
auth headers thenIan
02/10/2019, 4:05 PM"/mouse/{id}"
rather than "/mouse/:id"
, which seems a little more common?Manuel Lorenzo
02/11/2019, 2:50 PMmp
02/11/2019, 9:30 PMobobo
02/11/2019, 9:56 PMwithTimeout
, but will this handle cleanup properly, will it cancel the in-flight request? (I'm aware of, and using, connectTimeout
, but I want to timeout on the request as a whole, not just opening a connection.)kevin
02/12/2019, 7:31 AMManuel Lorenzo
02/12/2019, 10:28 AMDamiano Giusti
02/12/2019, 1:47 PMHttpClient
compiled against iOS it crashes because the Charset.ISO_8859_1
is not found. Kotlin 1.3.21, Ktor Client 1.1.2Damiano Giusti
02/12/2019, 2:18 PMhmole
02/12/2019, 6:25 PMDELETE
route method? Right now it returns 415.Dias
02/13/2019, 11:27 AMresponse.receive<String>()
it throws with BadResponseStatusException. I kinda understand the reason for that, but how do I read a message that comes with bad response?Andy
02/13/2019, 3:15 PMrunBlocking {
delay(500)
}
galex
02/13/2019, 8:29 PMgalex
02/14/2019, 6:02 AMIllegalArgumentException {message_8yp7un$_0: "should should be greater than write space + end ga… = 9, writeRemaining = 0, endGap = 8, rem+gap = 8", cause_th0jdv$_0: null, name: "IllegalArgumentException", stack: "IllegalArgumentException: should should be greater…8td$_0 (<http://localhost:9000/bundle.js:31435:19>)"}
bod
02/14/2019, 11:20 AMenum class MyEnum(val key: String) {
FOO("foo"),
BAR("bar"),
UNKNOWN("unknown");
companion object {
fun getByKey(key: String?): MyEnum {
return MyEnum.values().firstOrNull { it.key == key } ?: MyEnum.UNKNOWN
}
}
}
I’m looking for a way to not repeat this companion object for all our enums. Possibly a combination of an interface and a generic extension function? Any idea? 🙂igorvd
02/14/2019, 5:12 PMapplication.conf
modules = [ com.example.ApplicationKt.module, com.example.user.UserModuleKt.module ]
and create this extension into the UserModule file:
package com.example.user
fun Application.module() {
routing {
route("/users") {
get {
call.respondText("Users", ContentType.Text.Plain)
}
}
}
}
when I try to conect to the /users endpoint, I'm getting a 404 error 😕igorvd
02/14/2019, 5:12 PMapplication.conf
modules = [ com.example.ApplicationKt.module, com.example.user.UserModuleKt.module ]
and create this extension into the UserModule file:
package com.example.user
fun Application.module() {
routing {
route("/users") {
get {
call.respondText("Users", ContentType.Text.Plain)
}
}
}
}
when I try to conect to the /users endpoint, I'm getting a 404 error 😕cy
02/14/2019, 5:19 PMigorvd
02/14/2019, 5:26 PMcy
02/14/2019, 5:28 PMigorvd
02/14/2019, 5:32 PMApplication.kt
file works, with this content:
fun main(args: Array<String>) {
val server = embeddedServer(Netty, port = 9000) {
routing {
trace { application.log.trace(it.buildText()) }
get("/") {
call.respondText("Hello World!", ContentType.Text.Plain)
}
}
}
server.start(wait = true)
}
/users
from the other file and paste here, works toocy
02/15/2019, 8:45 AMigorvd
02/15/2019, 5:03 PM