fix(http): timeout on http request

This commit is contained in:
hyb1996
2018-04-11 16:25:15 +08:00
parent dc790a297c
commit b49ea34585
2 changed files with 80 additions and 4 deletions

View File

@@ -1,6 +1,10 @@
module.exports = function(runtime, scope){
importPackage(Packages["okhttp3"]);
importClass(com.stardust.autojs.core.http.MutableOkHttp);
var http = {};
http.__okhttp__ = new MutableOkHttp();
http.get = function(url, options, callback){
options = options || {};
options.method = "GET";
@@ -8,10 +12,7 @@ module.exports = function(runtime, scope){
}
http.client = function(){
if(!http._client_){
http._client_ = new OkHttpClient();
}
return http._client_;
return http.__okhttp__.client();
}
http.post = function(url, data, options, callback){