添加java.head方法

用法与java.get 相同
This commit is contained in:
ag2s20150909
2022-04-29 22:07:08 +08:00
parent f7d4b272c9
commit 45c6dd1d61
@@ -218,6 +218,19 @@ interface JsExtensions {
.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
*/