0
본문 매개 변수에 문자열 컬렉션과 함께 POST 요청을 보내려고합니다. 다음은 여기문자열의 컬렉션과 함께 발리를 사용하여 POST 요청을 보내는 방법
{
"Emails": [
"sample string 1",
"sample string 2"
]
}
및 포맷팅 및 내 요청의 샘플은 내가 trying-
private void sendEmailRequest(final String email, String playId) {
String url = "https://someurl";
Map<String, String> postParam = new HashMap<String, String>();
postParam.put("Emails", "["+ email +"]");
JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.POST, url,new JSONObject(postParam),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
}
}){
/**
* Passing some request headers
* */
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "Bearer " + myToken);
headers.put("Content-Type", "application/json; charset=utf-8");
return headers;
}
};
// Adding request to request queue
AppController.getInstance().addToRequestQueue(jsonRequest, tagStringReq);
}
오전 것입니다하지만 항상 오류 onErrorResponse 방법에 간다
E/Volley: [613] BasicNetwork.performRequest: Unexpected response code 500 for https://someurl
을 로그 - 이 문제를 극복하기위한 제안을 해주십시오.