我正在尝试使用 Retrofit 2 从 Android 登录到服务器。用于登录的 API 在邮递员(REST 客户端工具)中运行良好,并得到这样的响应[ { "success": true, "message": "Enjoy your token!", "token": "ABCDEFGHIJKLMNOPQESTUVWXYZ", "log_id": 1234 }]但是当我使用 Retrofit 2 在 Android 中尝试使用相同的流程时,我得到了不同的输出。这是我在 android 中调用 Login API 时的 Android 日志片段。08-12 11:27:29.299 13457-13593/com.example.user.retrofit D/OkHttp: --> POST http://www.test.com/api/authenticate http/1.108-12 11:27:29.300 13457-13593/com.example.user.retrofit D/OkHttp: Content-Type: application/json; charset=UTF-8 Content-Length: 181 Accept: application/json08-12 11:27:29.301 13457-13593/com.example.user.retrofit D/OkHttp: {"data":"VTJGc2RHVmtYMWdNYj1E"} --> END POST (181-byte body)08-12 11:27:35.087 13457-13593/com.example.user.retrofit D/OkHttp: <-- 200 https://www.test.com/api/authenticate (5785ms) content-type: text/html cache-control: no-cache content-length: 210 x-iinfo: 7-48850495-0 0NNN RT(1534053455965 0) q(0 -1 -1 5) r(0 -1) B10(4,289,0) U5 set-cookie: visid_incap_1748743=CMWA4MwbTNGL5G0hHnAZBE/Mb1sAAAAAQUIPAAAAAADakNS0YTyMIvKXh6Zh0cjx; expires=Sun, 11 Aug 2019 09:31:38 GMT; path=/; Domain=.test.com set-cookie: incap_ses_705_1748743=z9lvBtlqCnHsdSffSqrICU/Mb1sAAAAAgZliHJa2lcppoIp0iVqtng==; path=/; Domain=.test.com08-12 11:27:35.088 13457-13593/com.example.user.retrofit D/OkHttp: <html> <head> <META NAME="robots" CONTENT="noindex,nofollow"> <script src="/_Incapsula_Resource?SWJIYLWA=5074a744e2e3d891814e9a2dace20bd4,719d34d31c8e3a6e6fffd425f7e032f3">08-12 11:27:35.089 13457-13593/com.example.user.retrofit D/OkHttp: </script> <body> </body></html> <-- END HTTP (210-byte body)
添加回答
举报
0/150
提交
取消