I have another issue (hopefully last one). I load ...
# ktor
t
I have another issue (hopefully last one). I load a list of quotes from an api. Everything worked fine before migration.
Copy code
override 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)
Copy code
[
   {
      "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?
s
Shot in the dark: maybe you're getting an error response, but it's trying to deserialise it anyway because
expectSuccess
now defaults to
false
?
t
I get a 200 Ok Response with Content-Type: application/json , so I think that should be fine 🤔
s
Yeah, sounds like my guess was not correct
t
Still happy for your thoughts anyway!
a
Could you please share an endpoint that is requested in your example if it's a public one?