我在HttpDelete
Android中请求发送rest API时遇到问题。
当我点击API时显示错误。需要内容类型,我在标题中设置它,但没有找到任何我需要帮助的解决方案。
这是我尝试过的代码:
DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
String paramString = URLEncodedUtils.format(nameValuePairs, "utf_8");
url += "?" + paramString;
HttpDelete httpDelete = new HttpDelete(url);
httpDelete.setHeader("Iauth" ,"1");
httpDelete.setHeader("Msessid" ,sessionid);
httpDelete.addHeader("content-type","x-www-form-urlencoded");
Log.d("URLLLLL",url);
// httpPost.setHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8");
HttpResponse httpResponse = defaultHttpClient.execute(httpDelete);
HttpEntity httpEntity = httpResponse.getEntity();
inputStream = httpEntity.getContent();