okhttp-OkGo icon indicating copy to clipboard operation
okhttp-OkGo copied to clipboard

后台接口请求返回500 但是body 返回了提示消息, 请求直接进了onError 请问怎么获取到body 中的消息?

Open honganxue opened this issue 4 years ago • 2 comments

I/OkHttp: <-- 500 Internal Server Error http://120.24.62.145:8153/admin/login/token (365ms) 2020-09-29 12:50:46.721 11366-11431/com.example.transferstation.activity I/OkHttp: transfer-encoding: chunked 2020-09-29 12:50:46.723 11366-11431/com.example.transferstation.activity I/OkHttp: X-Request-Id: 97c15a52-f5f5-4b8f-895c-55fe46ec997a 2020-09-29 12:50:46.724 11366-11431/com.example.transferstation.activity I/OkHttp: Expires: 0 2020-09-29 12:50:46.726 11366-11431/com.example.transferstation.activity I/OkHttp: Cache-Control: no-cache, no-store, max-age=0, must-revalidate 2020-09-29 12:50:46.726 11366-11431/com.example.transferstation.activity I/OkHttp: X-XSS-Protection: 1; mode=block 2020-09-29 12:50:46.728 11366-11431/com.example.transferstation.activity I/OkHttp: Pragma: no-cache 2020-09-29 12:50:46.729 11366-11431/com.example.transferstation.activity I/OkHttp: X-Frame-Options: DENY 2020-09-29 12:50:46.731 11366-11431/com.example.transferstation.activity I/OkHttp: Date: Tue, 29 Sep 2020 04:51:18 GMT 2020-09-29 12:50:46.732 11366-11431/com.example.transferstation.activity I/OkHttp: X-Content-Type-Options: nosniff 2020-09-29 12:50:46.733 11366-11431/com.example.transferstation.activity I/OkHttp: Content-Type: application/json;charset=UTF-8 2020-09-29 12:50:46.735 11366-11431/com.example.transferstation.activity I/OkHttp: Referrer-Policy: no-referrer 2020-09-29 12:50:46.735 11366-11431/com.example.transferstation.activity I/OkHttp:
2020-09-29 12:50:46.746 11366-11431/com.example.transferstation.activity I/OkHttp: body:{"code":3000,"message":"账号或密码错误!","path":"/login/token","data":{},"extra":{},"timestamp":"1601355078274"}

honganxue avatar Sep 29 '20 04:09 honganxue

body有数据,回调走onError,我一脸蒙蔽

laojichao avatar Jan 13 '21 02:01 laojichao

body有数据,回调走onError,我一脸蒙蔽 后台接口,http 状态码返回问题,检查一下

honganxue avatar Jan 13 '21 03:01 honganxue