【发布时间】:2018-08-08 11:11:24
【问题描述】:
我的应用程序现在已经运行了一段时间,并且一切运行良好! 服务器最近从http更新到https, 自从那次更改以来,我在每次服务器调用时都会收到错误 400 BAD INPUT。 在研究了一些痛苦的小时后,我发现如果我发送一个带有空标题的请求,请求就会通过!没有错误。 但我需要那些标题!
此外,在 iOS 和我在 POSTMAN 中的检查中,标头都运行良好,所以我认为问题一定出在客户端。
我正在发送我的标题覆盖 getHeaders 方法。
以前有人遇到过这个问题吗? 知道如何解决这个问题吗?
我的标题代码:
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=utf8");
headers.put("AppVersion", BaseApplication.getCurrentDevice().getAppVersion());
headers.put("DeviceType", BaseApplication.getCurrentDevice().getDeviceType().toString());
return headers;
}
【问题讨论】:
-
只添加
application/json -
已经尝试过了,仍然收到 400 错误。 =\
-
尝试在Firefox或chrome中添加
Rest Client Extension并尝试