Skip to main content
David Cruz Anaya

David Cruz Anaya

Senior Android & Kotlin Multiplatform Engineer

  • Home
  • About
  • Portfolio
  • Book
  • Speaking
  • Blog
  • Flashcards
  • Nomad Life
  • Contact
Visit Vectencia Shop

Follow Me

Privacy Policy

2014 - 2026 © davthecoder is trading as Vectencia Ltd.

davthecoder
davthecoder.com
davthecoder × Vectencia
🌐

Ktor Client Pitfalls

Find the bugs in each code snippet

API Service1 P03 total
1/6
1class HotelApiService {
2
3 suspend fun searchHotels(query: String): List<Hotel> {
4 val client = HttpClient(CIO) {
5 install(ContentNegotiation) {
6 json(Json { ignoreUnknownKeys = true })
7 }
8 }
9
10 val response: List<Hotel> = client.get("https://api.example.com/hotels") {
11 parameter("q", query)
12 }.body()
13
14 return response
15 }
16
17 suspend fun getHotelDetails(id: String): Hotel {
18 val client = HttpClient(CIO) {
19 install(ContentNegotiation) {
20 json(Json { ignoreUnknownKeys = true })
21 }
22 }
23
24 return client.get("https://api.example.com/hotels/$id").body()
25 }
26}
Click on the lines you think have bugsFound 0 of 3
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off
Skip to main content
David Cruz Anaya

David Cruz Anaya

Senior Android & Kotlin Multiplatform Engineer

  • Home
  • About
  • Portfolio
  • Book
  • Speaking
  • Blog
  • Flashcards
  • Nomad Life
  • Contact
Visit Vectencia Shop

Follow Me

Privacy Policy

2014 - 2026 © davthecoder is trading as Vectencia Ltd.

davthecoder
davthecoder.com
davthecoder × Vectencia
🌐

Ktor Client Pitfalls

Find the bugs in each code snippet

API Service1 P03 total
1/6
1class HotelApiService {
2
3 suspend fun searchHotels(query: String): List<Hotel> {
4 val client = HttpClient(CIO) {
5 install(ContentNegotiation) {
6 json(Json { ignoreUnknownKeys = true })
7 }
8 }
9
10 val response: List<Hotel> = client.get("https://api.example.com/hotels") {
11 parameter("q", query)
12 }.body()
13
14 return response
15 }
16
17 suspend fun getHotelDetails(id: String): Hotel {
18 val client = HttpClient(CIO) {
19 install(ContentNegotiation) {
20 json(Json { ignoreUnknownKeys = true })
21 }
22 }
23
24 return client.get("https://api.example.com/hotels/$id").body()
25 }
26}
Click on the lines you think have bugsFound 0 of 3
←→NavigateAShow remainingRReset
🎯Bug Formula: What's wrong → What breaks for the user → The fix → The trade-off