[英]How to make a PATCH request with jSONObjectRequest in android volley?
I want to make a PATCH request with json object request in android using volley library. 我想使用volley库在android中使用json对象请求发出PATCH请求。 Its working in postman but when i call it in android, it gives me error 405,Anybody have any idea How to do it? 它在邮递员工作,但当我在android中调用它时,它给我错误405,任何人有任何想法如何做到这一点? Below is my code: 以下是我的代码:
requestQueue.add( new JsonObjectRequest(Request.Method.PATCH,url, jsonObject, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
GiveCentralUtilities.setCurrentFragment(getActivity(),R.id.fragment_container,
SignUpPaymentInfo.newInstance(isSignup),SignUpPaymentInfo.TAG);
// getAccessToken();
}
}, this){
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> header = new HashMap<String, String>();
header.put("Authorization","Bearer "+GiveCentralUtilities.getPref(GiveCentralConstants.ACCESSTOKEN,getActivity()));
header.put("Accept", "application/json");
// header.put("Content-Type", "application/json");
System.out.println("vivekaccess"+GiveCentralUtilities.getPref(GiveCentralConstants.ACCESSTOKEN,getActivity()));
return header;
}
@Override
public String getBodyContentType() {
return "application/json";
}
});
Error 405 means that this error does not come from your JsonObjectRequest. 错误405表示此错误不是来自您的JsonObjectRequest。 It may be caused by the url, your android phone's network or the server 它可能是由网址,Android手机的网络或服务器引起的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.