Skip to content

Commit 7d2f97f

Browse files
authored
fix(client): use submitForm instead of get requests in some methods (#282)
1 parent 67fc689 commit 7d2f97f

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
applicationId = "dev.yashgarg.qbit"
2727
minSdk = 24
2828
targetSdk = 33
29-
versionCode = 10
30-
versionName = "v0.2.$versionCode-$commitHash"
29+
versionCode = 11
30+
versionName = "v0.2.0-$commitHash"
3131

3232
multiDexEnabled = true
3333
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

client-wrapper/client/src/commonMain/kotlin/QBittorrentClient.kt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,10 @@ class QBittorrentClient(
367367
@Throws(QBittorrentException::class, CancellationException::class)
368368
suspend fun pauseTorrents(hashes: List<String> = allList) {
369369
http
370-
.get("${config.baseUrl}/api/v2/torrents/pause") {
371-
parameter("hashes", hashes.joinToString("|"))
372-
}
370+
.submitForm(
371+
"${config.baseUrl}/api/v2/torrents/pause",
372+
formParameters = Parameters.build { append("hashes", hashes.joinToString("|")) }
373+
)
373374
.orThrow()
374375
}
375376

@@ -381,9 +382,10 @@ class QBittorrentClient(
381382
@Throws(QBittorrentException::class, CancellationException::class)
382383
suspend fun resumeTorrents(hashes: List<String> = allList) {
383384
http
384-
.get("${config.baseUrl}/api/v2/torrents/resume") {
385-
parameter("hashes", hashes.joinToString("|"))
386-
}
385+
.submitForm(
386+
"${config.baseUrl}/api/v2/torrents/resume",
387+
formParameters = Parameters.build { append("hashes", hashes.joinToString("|")) }
388+
)
387389
.orThrow()
388390
}
389391

@@ -411,19 +413,21 @@ class QBittorrentClient(
411413
@Throws(QBittorrentException::class, CancellationException::class)
412414
suspend fun recheckTorrents(hashes: List<String> = allList) {
413415
http
414-
.get("${config.baseUrl}/api/v2/torrents/recheck") {
415-
parameter("hashes", hashes.joinToString("|"))
416-
}
416+
.submitForm(
417+
"${config.baseUrl}/api/v2/torrents/recheck",
418+
formParameters = Parameters.build { append("hashes", hashes.joinToString("|")) }
419+
)
417420
.orThrow()
418421
}
419422

420423
/** Reannounce a torrent. */
421424
@Throws(QBittorrentException::class, CancellationException::class)
422425
suspend fun reannounceTorrents(hashes: List<String> = allList) {
423426
http
424-
.get("${config.baseUrl}/api/v2/torrents/reannounce") {
425-
parameter("hashes", hashes.joinToString("|"))
426-
}
427+
.submitForm(
428+
"${config.baseUrl}/api/v2/torrents/reannounce",
429+
formParameters = Parameters.build { append("hashes", hashes.joinToString("|")) }
430+
)
427431
.orThrow()
428432
}
429433

0 commit comments

Comments
 (0)