Made sure the connection is disconnected

This commit is contained in:
Erik C. Thauvin 2024-12-22 15:00:56 -08:00
parent 137201c3e7
commit 76f78a8688
Signed by: erik
GPG key ID: 776702A6A2DA330E

View file

@ -51,6 +51,7 @@ internal fun fetchUrl(url: String, auth: String = ""): String {
}
val connection = URL(url).openConnection() as HttpURLConnection
try {
connection.setRequestProperty(
"User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0"
)
@ -67,6 +68,9 @@ internal fun fetchUrl(url: String, auth: String = ""): String {
} else {
throw httpError(connection.responseCode)
}
} finally {
connection.disconnect()
}
}
private fun httpError(responseCode: Int): HttpErrorException {