当我使用Postman时,
从原始作品中获取价值完美
但在Android中,我收到错误代码415.
REVIEW_URL = "http://somesite.esy.es/api.php/registration";
RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
StringRequest request = new StringRequest(Request.Method.POST, REVIEW_URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("RESPONSE:", response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("ERROR",""+error.getMessage());
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String,String>();
params.put("device_id", "11111");
return params;
}
@Override
public String getBodyContentType() {
return "application/raw";
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> params = new HashMap<String,String>();
params.put("Content-Type", "application/raw");
return params;
}
};
requestQueue.add(request);
我是否正确地将内容类型转换为原始类型?感谢。