Skip to content

Commit

Permalink
improve json parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
shalva97 committed May 13, 2024
1 parent ad0ee6b commit 9402556
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PlayerSearch {
}
private val client = HttpClient {
install(ContentNegotiation) {
jsonParser
json(jsonParser)
}
}

Expand All @@ -44,8 +44,8 @@ public class PlayerSearch {
public suspend fun getPlayerProfile(playerTag: String): PlayerProfileStats {
val tagForOwapi = playerTag.replace('#', '-')

val response = client.get("https://owapi.eu/stats/pc/$tagForOwapi/complete").bodyAsText()
return jsonParser.decodeFromString(response)
return client.get("https://owapi.eu/stats/pc/$tagForOwapi/complete")
.body<PlayerProfileStats>()
}

public fun getAvatar(id: String): String? {
Expand Down

0 comments on commit 9402556

Please sign in to comment.