Android Volley gives me 400 error
本文来自:http://stackoverflow.com/questions/21739276/android-volley-gives-me-400-error
本人是根据文中的其中一方法:
I had the same problem and i removed from the header:
headers.put("Content-Type", "application/json");
now it works great!
以下是全文
I'm trying to make a
I get the following error:
I have seen a lot of examples and I don't really see what is going wrong here. Anyone any idea? I updated the code with this method:
and changed
Still getting the same error! |
|||||||||||||||||||||
|
I had the same problem and i removed from the header:
now it works great!
|
|||||
|
400 indicates a bad request, maybe you're missing |
|||||||||||||||||||||
|
I've got this error and now Iit's been fixed. I did what is told in this link. What you need to do is
with
Hope this helps. |
||||
I have removed this params.put("Content-Type", "application/x-www-form-urlencoded"); This is my Code Change.
|
|||
I have the same issue before and I got the solution in my project:
In the code Snippet above I used Post Method: My answer is base on my experience and so take note: 1.) When using POST method use "StringRequest" instead of "JsonObjectRequest" 2.) inside getHeaders Override the value with an Empty HashMap
And everything works in my case. |
|||
In Android 2.3 there is a problem using Base64.encodeToString() as it introduces a new line in HTTP header. See my response to this question here in SO. Short answer: Don't use Base64.encodeToString() but put the already encoded String there. |
||||
400 error is because Content-Type is set wrong. Please do the following.
|
|||
There can be multiple reasons for this error. One ofcouse as said by others is, maybe you are missing or have improperly set 'Content-type' header. If you are properly implemented that, other possible reason is that you are sending params directly from your url. There may be a case when params is a string with some white spaces in it. These white spaces cause problem in GET requests through volley. You need to find another way around it. Thats all. |
|||||||||
|
Android Volley gives me 400 error的更多相关文章
- Android Volley彻底解决(三),定制自己Request
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/17612763 经过前面两篇文章的学习,我们已经掌握了Volley各种Request ...
- [Android]Volley的使用
Volley是Google I/O 2013上提出来的为Android提供简单快速网络访问的项目.Volley特别适合数据量不大但是通信频繁的场景. 优势 相比其他网络载入类库,Volley 的优势官 ...
- [转] Android Volley完全解析(一),初识Volley的基本用法
版权声明:本文出自郭霖的博客,转载必须注明出处. 目录(?)[-] Volley简介 下载Volley StringRequest的用法 JsonRequest的用法 转载请注明出处:http ...
- Android Volley入门到精通:定制自己的Request
经过前面两篇文章的学习,我们已经掌握了Volley各种Request的使用方法,包括StringRequest.JsonRequest.ImageRequest等.其中StringRequest用于请 ...
- Android Volley入门到精通:使用Volley加载网络图片
在上一篇文章中,我们了解了Volley到底是什么,以及它的基本用法.本篇文章中我们即将学习关于Volley更加高级的用法,如何你还没有看过我的上一篇文章的话,建议先去阅读Android Volley完 ...
- Android Volley入门到精通:初识Volley的基本用法
1. Volley简介 我们平时在开发Android应用的时候不可避免地都需要用到网络技术,而多数情况下应用程序都会使用HTTP协议来发送和接收网络数据.Android系统中主要提供了两种方式来进行H ...
- Android Volley完全解析
1. Volley简介 我们平时在开发Android应用的时候不可避免地都需要用到网络技术,而多数情况下应用程序都会使用HTTP协议来发送和接收网络数据.Android系统中主要提供了两种方式来进行H ...
- Android Volley和Gson实现网络数据加载
Android Volley和Gson实现网络数据加载 先看接口 1 升级接口 http://s.meibeike.com/mcloud/ota/cloudService POST请求 参数列表如下 ...
- Android Volley源码分析
今天来顺手分析一下谷歌的volley http通信框架.首先从github上 下载volley的源码, 然后新建你自己的工程以后 选择import module 然后选择volley. 最后还需要更改 ...
随机推荐
- Whole life
Whole life the wonder such you bring the beautyI can see but i keep deep inside on itOh life i feel ...
- java培训第一天--画板
package day1; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt ...
- list内容按长度等分
这里需要导入 from more_itertools import chunked chunked(iterable, n) 将一个可迭代对象等分成n个list,第n个list的长度可能小于之前的. ...
- adb shell
1.获取进程ID adb shell ps |findstr packagename 2.获取cpu的值 adb shell dumpsys cpuinfo |findstr packagename ...
- 10款html5开发工具,实用+好用
利用HTML5工具不仅可以帮助设计师和开发者创建更具吸引力的网站,还能增加网站的可用性和可访问性.本文收集了10款HTML5开发工具让你在网页中搭建特效.动画.视频.音频等诸多功能,为你节省更多开发时 ...
- 【python】错误/异常处理,调试,测试
try: print('try') r=10/2 print('result is:',r) #发生错误,会执行这部分 except ValueError as e: print('ValueErro ...
- Apache多站点配置(ubuntu)
1,先进入Apaches2的目录下 cd /etc/apache2 2,进入sites-available中 cd sites-available vi 000-default.conf ...
- .net core 学习笔记(2)-中间件
小项目中有个操作日志的功能,主要是记录用户对修改数据的操作进行记录,记录的内容包括 访问的控制器和方法,以及控制器方法中接收的参数,操作用户,及操作IP等信息,最开始是用ActionFilterAtt ...
- weixin 公众平台开发
http://www.cnblogs.com/szw/archive/2013/05/14/weixin-course-index.html http://weixin.senparc.com/
- Ngui中Sprite,SlicedSprite,Tiled Sprite,FilledSprite的区别
Sprite:标准Sprite控件,自适应图片大小. Sliced Sprite:一个含有9个切片的Sprite,创建固定边框的控件最佳选择,固定大小,不会随图片大小而改变,可做人物头像等. Tile ...