Comments (4)
返回的数据必须是下面的格式:
{
"Code":0,
"Msg":"",
"Data":{ //数据内容
}
}
from xhttp2.
Code、Msg、Data必须都是大写
from xhttp2.
自定义返回体的格式:https://github.com/xuexiangjys/XHttp2#%E8%87%AA%E5%AE%9A%E4%B9%89api%E8%AF%B7%E6%B1%82
from xhttp2.
数据返回格式:
{
status: "1",
message: "OK",
result: "663046792267785498951364"
}
bean实体类:
public class User extends ApiResult {
private String status;
private String message;
private T result;
@Override
public int getCode() {
return Integer.parseInt(status);
}
@Override
public String getMsg() {
return message;
}
@Override
public boolean isSuccess() {
return true;
}
@Override
public T getData() {
return result;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getResult() {
return result;
}
public void setResult(T result) {
this.result = result;
}
}
请求:
XHttp.get("/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest")
.execute(new CallBackProxy<User, String>(new TipRequestCallBack() {
@OverRide
public void onSuccess(String response) throws Throwable {
Log.e("test","返回的response--->"+response.toString());
}
}));
报错:
E/XHttp: --> Subscriber is onError
E/XHttp: --> e instanceof ApiException, message:ApiResult.class.isAssignableFrom(cls) err!!
你好 请问一下这是什么原因呢? 我调试了挺久 看不出问题
from xhttp2.
Related Issues (20)
- 发起多个网络请求,等待请求结束后再处理其他的的任务 HOT 1
- 后端使用 sa-token ,安卓如何 获取请求 后的 response header 的 cookie HOT 1
- 这个是不是不支持嵌套泛型啊? HOT 1
- Xhttp 请求生命周期绑定 HOT 3
- 你好,请问我上传图片如何使用生命周期绑定? HOT 5
- 如何同步获取网络请求结果 HOT 3
- 请问怎么修改请求头为application/json HOT 2
- 请求后台总是返回onError,不会进onSuccess HOT 2
- NetMethod能否支持设置hearder参数哈 HOT 4
- addPostParamsSign HOT 3
- 设置非严格模式不起作用 HOT 2
- 网络请求成功,但总是进入onError()方法 HOT 1
- 文件上传在真机上总是报网络请求超时,而模拟器上基本不会 HOT 1
- 服务器返回data为“”时,会报“类型转换错误” HOT 4
- 根据文件路径获取不到文件 HOT 2
- 大佬,能否兼容一下非正常返回的ApiResult中,服务端返回 data 为空字符串的这种情况?或者解决方案 谢谢 HOT 1
- 如何开启同步请求的? HOT 1
- 文件下载开始后如何能够在update的回调中停止下载? HOT 2
- 希望提供限流支持 HOT 1
- 无法解析接收的JSON中字符串格式日期 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 xhttp2.