hi everyone ! im facing a problem in ktor Client...
# ktor
h
hi everyone ! im facing a problem in ktor Client side I build a ktor server thats running correctly but when im making a simple GET request it not working (throwing Exception)
Copy code
override suspend fun getAllMessages(chatId : String): MessageDto {
  return  try {
        val url = URLBuilder().apply {
            takeFrom(MessageServices.BASE_URL)
            path("getMessages")
            parameters.append("id", chatId)
        }.build()

        Log.d("TAG", "getAllMessages: url is -> ${url}")
        httpClient.get<MessageDto>(url)
    } catch (e: Exception) {
        // Handle other exceptions (e.g., network issues)
        Log.d("TAG", "getAllMessages: Not GETTING DATA")
        e.printStackTrace()
      MessageDto("Not Getting Data returning Empty List", emptyList())
    }
}
Logger showing this and i also tryed with retrofit to double check that server realy working fine and retrofit returning expected response but i dont know whats wrong with this ktor code that i write , help!!!!
c
What does the stacktrace say? How is your MesssageDto setup? I suspect a deserialization error.
h
Yes , it's a deserialization error After spending a lot of time i figured out I did a mistake on the server side I'm returning a (Json.encodeToString) It working with retrofit but in ktor Clint side I need to accept it in (Content type.Any ) but I simply change the server side so that it will return Json on every request