Skip to content

Commit

Permalink
fix: Removed client functions that made it being closed
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbyESP committed Nov 17, 2023
1 parent 7ce184e commit 1c4f948
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ object GithubAPI {
suspend fun getLatestRelease(): Release {
val response = client.get(BASE_URL + "repos/Lambada10/SongSync/releases/latest")
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

return json.decodeFromString<Release>(responseBody)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class LRCLibAPI {
baseURL + "search?q=$search"
)
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

if (responseBody == "[]" || response.status.value !in 200..299)
return null
Expand All @@ -59,7 +58,6 @@ class LRCLibAPI {
baseURL + "get/$id"
)
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

if (response.status.value !in 200..299 || responseBody == "[]")
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class NeteaseAPI {
parameter("s", search)
}
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

if (responseBody == "[]" || response.status.value !in 200..299)
return null
Expand Down Expand Up @@ -102,7 +101,6 @@ class NeteaseAPI {
parameter("lv", 1)
}
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

if (response.status.value !in 200..299 || responseBody == "[]")
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class SpotifyAPI {
)
}
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

val json = json.decodeFromString<WebPlayerTokenResponse>(responseBody)

Expand Down Expand Up @@ -71,7 +70,6 @@ class SpotifyAPI {
headers.append("Authorization", "Bearer $spotifyToken")
}
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

val json = json.decodeFromString<TrackSearchResult>(responseBody)
if (json.tracks.items.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class SpotifyLyricsAPI {
suspend fun getSyncedLyrics(songLink: String): String? {
val response = client.get("$baseURL?url=$songLink&format=lrc")
val responseBody = response.bodyAsText(Charsets.UTF_8)
client.close()

if (response.status.value !in 200..299)
return null
Expand Down

0 comments on commit 1c4f948

Please sign in to comment.