在 Post 请求中检索错误 417
我创建了一个 API,我可以向其发送 Post 请求以进行登录。它在 Android 4.0 上运行良好,我还有另一部 Android 2.3 手机,它也运行良好。 无论如何,当我在 HTC Desire 上进行测试时,当我发出 Post 请求时,我会从 API 中检索到 417 错误。 我已经尝试将 USE_EXPECT_CONTINUE 参数添加到我的 HttpParams 中:
my_httpParams.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
另外,我尝试将它添加到我的清单中,如下所示:
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
虽然不起作用,但我不知道为什么..它在其他设备上也能工作也很奇怪?
I made an API, which I can send a Post request to, for a login. It works fine on Android 4.0, and I have another Android phone with 2.3, which works fine as well.
Anyhow, When I test on a HTC Desire, I'm retrieving the 417 error from the API when I make a Post request.
I already tried adding the USE_EXPECT_CONTINUE parameter to my HttpParams:
my_httpParams.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
Also, I tried to add it to my Manifest like this:
<system.net>
<settings>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>
Is doesn't work though, and I have no idea why.. It's also weird that it does work on other devices?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我修好了。需要在 httpclient 参数上设置 USE_EXPECTED_CONTINUE 参数,如下所示:
现在工作正常!
I fixed it. The USE_EXPECTED_CONTINUE param needs to be set on the httpclient param, like this:
Works fine now!