dany giguere
02/15/2022, 11:19 PMdany giguere
02/15/2022, 11:20 PMfkrauthan
02/16/2022, 12:26 AMktor-client
feature that has a sendPipeline
and a receivePipeline
intercept. How can I pass values from the sendPipeline intercept to the receivePipeline intercept (e.g. a class instance and/or some value)?ribesg
02/16/2022, 2:10 PMKarl Azzam
02/16/2022, 2:21 PMMichal Klimczak
02/16/2022, 3:02 PMInvalidMutabilityException: mutation attempt of frozen kotlin.Array@249bab0
in kfun:io.ktor.client.plugins.json.serializer.SerializerInitializer.<init>#internal
fkrauthan
02/16/2022, 8:46 PMktor-client
question. Is the
scope.receivePipeline.intercept(HttpReceivePipeline.State) {
always getting executed even if the API call failed (e.g. Invalid Host or Timeout)? If yes what value would context.response.status.value
contain? And if not what pipeline do I need to adjust to to catch that?tateisu
02/17/2022, 12:00 AMHttpResponse.body()
?Fabrizio Scarponi
02/17/2022, 2:35 PMzt
02/17/2022, 11:20 PMPiotr Krzemiński
02/18/2022, 7:13 AMchristophsturm
02/18/2022, 12:28 PMsultanofcardio
02/18/2022, 12:51 PMansman
02/18/2022, 5:28 PMWebSocketSession
would be canceled (the coroutine that is) when both the incoming and outgoing channels are closed but this doesn’t seem to be the case. Can someone confirm that this is the intended behavior?André Martins
02/18/2022, 5:42 PMJorge Bo
02/18/2022, 8:32 PMTobias Gronbach
02/19/2022, 11:45 AMTobias Gronbach
02/19/2022, 12:14 PMoverride suspend fun authenticateUser(userNameHash: String, passwordHash: String): UserAuthData? {
return try {
<http://client.post|client.post>(HttpRoutes.AUTHENTICATE_USER_FQDN) {
contentType(ContentType.Application.Json)
setBody {
UserRegistrationData(
userNameHash = userNameHash,
passwordHash = passwordHash
)
}
}.body<UserAuthData>()
} catch (e: Exception) {
...
}
}
Data Class looks like this:
@kotlinx.serialization.Serializable
data class UserRegistrationData(
val userNameHash: String,
val passwordHash: String
)
HttpClient
HttpClient(Android) {
....
install(ContentNegotiation) {
json(Json {
ignoreUnknownKeys = true
isLenient = true
}
)
}
....
}
Dependencies (for serialization)
implementation("io.ktor:ktor-client-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
Error Message:
Line: 58, Method: authenticateUser: Serializer for class 'null' is not found.
Mark the class as @Serializable or provide the serializer explicitly.Tobias Gronbach
02/19/2022, 1:10 PMoverride suspend fun getInspiringQuotes(): Resource<List<InspiringQuoteRemote>> {
return try {
val quotes = client.get {
url(WordpressRoutes.InspiringQuotes)
}.body<List<InspiringQuoteRemote>>()
Resource.Success(quotes)
} catch (e: Exception) {
Timber.e(e)
Resource.Error(e.localizedMessage)
}
}
This is the json-response I receive. I validated the response with an online tool that said it's a VALID (RFC 8259)
[
{
"quote_author":"Oskar Wilde",
"quote":"Unzufriedenheit ist der erste Schritt zum Erfolg."
},
{
"quote_author":"Winston Churchill",
"quote":"Erfolg haben heißt, einmal mehr aufstehen, als man hingefallen ist."
},
{
"quote_author":"Henry Ford",
"quote":"Erfolg besteht darin, dass man genau die Fähigkeiten hat, die im Moment gefragt sind."
},
{
"quote_author":"Albert Einstein",
"quote":"Der sicherste Ort für ein Schiff ist der Hafen. Doch dafür sind Schiffe nicht gemacht."
}
]
Still I get the following error.
kotlinx.serialization.json.internal.JsonDecodingException: Expected start of the array '[', but had 'EOF' instead
Any idea?brabo-hi
02/20/2022, 4:03 AMclient.close()
client.wss() {
incoming.consumeAsFlow().onCompletion{
// never stops receiving even after closing connection with `client.close()`
}
}
Recca Chao
02/20/2022, 12:10 PMspierce7
02/20/2022, 4:20 PMdany giguere
02/20/2022, 5:55 PMfun validate(title: String): Json {
val errors: Json
val titleArray: Array<String?>
if(title.length < 20) {
titleArray.add("The title must contain at least 20 characters")
}
if(title.length > 100) {
titleArray.add("The title must contain no more than 100 characters")
}
if(titleArray.length > 0) {
errors.title = titleArray
}
return Json {
"errors": errors
}
}
as it is, I get this error : Variable 'titleArray' must be initialized
Hien Nguyen
02/21/2022, 4:22 AMactual class Test actual constructor() {
actual val httpClientEngine: HttpClientEngineFactory<HttpClientEngineConfig>
get() = OkHttp
}
I’m integrating the certificate pinning to the ktor kmm
Does ktor use network_security_config
file in android ?rcd27
02/21/2022, 5:51 AMdownload
and I would like to keep the original one.
routing {
static("/download") {
defaultResource("distributive/loottherun-desktop-0.10.29.zip")
}
}
So when I go to localhost:8080/download
I see that browser "downloads" download
file. It is the same as my zip, but naming is wrong. How I can keep the right naming? Tried to play around arguments in defaultResource method, but didn't work.Omar Habash
02/21/2022, 12:35 PMSatyam Agarwal
02/21/2022, 2:11 PMDoubleReceive
feature for httpClients ?dany giguere
02/21/2022, 11:27 PMktor {
development = true
deployment {
port = 8080
port = ${?PORT}
}...
Kiet
02/21/2022, 11:41 PMdany giguere
02/22/2022, 12:14 AMdany giguere
02/22/2022, 12:14 AMAleksei Tirman [JB]
02/22/2022, 11:17 AM