Merge pull request #1827 from ag2s20150909/master

添加java.head方法
pull/1835/head
kunfei 3 years ago committed by GitHub
commit 16304b6c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      app/src/main/java/io/legado/app/help/JsExtensions.kt

@ -218,6 +218,19 @@ interface JsExtensions {
.execute() .execute()
} }
/**
* js实现重定向拦截,网络访问head,不返回Response Body更省流量
*/
fun head(urlStr: String, headers: Map<String, String>): Connection.Response {
return Jsoup.connect(urlStr)
.sslSocketFactory(SSLHelper.unsafeSSLSocketFactory)
.ignoreContentType(true)
.followRedirects(false)
.headers(headers)
.method(Connection.Method.HEAD)
.execute()
}
/** /**
* 网络访问post * 网络访问post
*/ */

Loading…
Cancel
Save