Comments (4)
- 全局配置(所有接口都生效)
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.readTimeout(5000, TimeUnit.MILLISECONDS);
builder.writeTimeout(5000, TimeUnit.MILLISECONDS);
builder.connectTimeout(5000, TimeUnit.MILLISECONDS);
EasyConfig.with(builder.build())
.into();
- 局部配置(只在某个请求生效)
OkHttpClient.Builder builder = EasyConfig.getInstance().getClient().newBuilder();
builder.readTimeout(5000, TimeUnit.MILLISECONDS);
builder.writeTimeout(5000, TimeUnit.MILLISECONDS);
builder.connectTimeout(5000, TimeUnit.MILLISECONDS);
EasyHttp.post(this)
.api(new XxxApi())
.client(builder.build())
.request(new HttpCallback<HttpData<Void>>(this) {
@Override
public void onSucceed(HttpData<Void> data) {
}
});
from easyhttp.
请问为什么我设置了3秒超时,但实际上还是7秒左右才提示超时
from easyhttp.
请问为什么我设置了3秒超时,但实际上还是7秒左右才提示超时
刚测了一下,局部配置正常,全局配置3秒,但实际大于3秒,秒表计时7秒左右
from easyhttp.
@is1988 你是不是设置了请求超时重试?
from easyhttp.
Related Issues (20)
- [疑惑]:下载请求怎么设置超时时间 HOT 5
- [疑惑]:如何添加单个网络请求的header或者cookies HOT 6
- [疑惑]:如何基于此网络框架,封装一个中间层 HOT 1
- [Bug]:多个接口header里面传同样key不同vaule,同时调用,会出现传错的问题 HOT 3
- [疑惑]:请问GET请求支持传key同名value值不同的参数吗 HOT 3
- [建议]:增加支持ProtoBuf格式数据解析 HOT 2
- [疑惑]:需求:发起一个http请求,有可能因为参数或者网络请求出错,不想在请求失败时弹出toast,显示出错信息给用户来看,怎样处理? HOT 1
- [疑惑]:请大佬指示一下如何把对象作为参数传给后台 HOT 1
- [建议]:请问以后会支持断点续传的功能么 HOT 38
- [疑惑]:请求参数都是key=value&key=value?能不能变成json的格式 HOT 4
- [疑惑]:为什么初始化会走一遍 RequestHandler 的 requestFail 方法
- [疑惑]:请求中加入headers,这个headers的token加密后的值比较长 HOT 10
- [疑惑]:formRequest 如何统一转换为JsonRequest HOT 1
- [Bug]:IRequestInterceptor中的方法interceptArguments发生在主线程 HOT 10
- [疑惑]:如何动态设置请求头 HOT 8
- [疑惑]:post提交参数的问题 是否可以直接map提交 HOT 2
- [疑惑]:为什么会出现多余的请求参数 HOT 5
- [Bug]:java.lang.ClassCastException: java.lang.Void cannot be cast to com.easy.demo.net.bean.HttpData HOT 8
- [疑惑]:关于easyHttp设置contentType,按照文档中的方法设置了,但是调用接口的时候还是会提示Content type 'application/x-www-form-urlencoded;charset=utf-8' not suppo HOT 1
- [疑惑]:是否有参数控制加载的时候 不出现加载动画? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easyhttp.