forked from recloudstream/cloudstream
Update HttpSession.kt
This commit is contained in:
parent
019f9b4ba7
commit
c283f9347b
1 changed files with 8 additions and 8 deletions
|
@ -19,12 +19,12 @@ class HttpSession {
|
||||||
companion object {
|
companion object {
|
||||||
const val DEFAULT_TIMEOUT = 30.0
|
const val DEFAULT_TIMEOUT = 30.0
|
||||||
|
|
||||||
fun mergeCookies(cookie1: Map<String, String>, cookie2: Map<String, String>?): Map<String, String> {
|
fun mergeCookies(cookie1: CookieJar, cookie2: Map<String, String>?): Map<String, String> {
|
||||||
val a = cookie1.toMutableMap()
|
val a = cookie1
|
||||||
if (!cookie2.isNullOrEmpty()) {
|
if (!cookie2.isNullOrEmpty()) {
|
||||||
a.putAll(cookie2.toMap())
|
a.putAll(cookie2)
|
||||||
}
|
}
|
||||||
return a.toMap()
|
return a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ class HttpSession {
|
||||||
val res = khttp.get(
|
val res = khttp.get(
|
||||||
url, headers, params,
|
url, headers, params,
|
||||||
data, json, auth,
|
data, json, auth,
|
||||||
mergeCookies(sessionCookies, cookies),
|
mergeCookies(sessionCookies, cookies), timeout,
|
||||||
timeout, allowRedirects,
|
allowRedirects,
|
||||||
stream, files
|
stream, files
|
||||||
)
|
)
|
||||||
sessionCookies.putAll(res.cookies)
|
sessionCookies.putAll(res.cookies)
|
||||||
|
@ -65,8 +65,8 @@ class HttpSession {
|
||||||
val res = khttp.post(
|
val res = khttp.post(
|
||||||
url, headers, params,
|
url, headers, params,
|
||||||
data, json, auth,
|
data, json, auth,
|
||||||
mergeCookies(sessionCookies, cookies),
|
mergeCookies(sessionCookies, cookies), timeout,
|
||||||
timeout, allowRedirects,
|
allowRedirects,
|
||||||
stream, files
|
stream, files
|
||||||
)
|
)
|
||||||
sessionCookies.putAll(res.cookies)
|
sessionCookies.putAll(res.cookies)
|
||||||
|
|
Loading…
Reference in a new issue