I am using Android Volley
library to send POST
request. And for POST
request
Content-Type:application/js
I found I had to override getBodyContentType()
in order to get the Content-Type
header to update correctly:
public String getBodyContentType()
{
return "application/json; charset=utf-8";
}
Here is my question with some more details on this issue:
Using network sniffing tool like Wireshark
,I found that my error lay on wrong HTTP header
. Then using Chrome DHC plugin
I found that Header Content-Type
should be application/json; charset=utf-8
and I was continuously using
Map<String, String> header = new HashMap<String, String>();
header.put("Content-Type", "application/json");
instead of
Map<String, String> header = new HashMap<String, String>();
header.put("Content-Type", "application/json; charset=utf-8");
Using proper Header
solved my issue