Android 애플리케이션에서 네트워크 작동을 위해 Google의 발리를 사용하고 있습니다. 요청을해야하지만 본문을 양식 데이터로 보낼 필요가있는 경우가 있습니다. 다른 모든 것을 시도했지만 양식 데이터로 요청할 수 없습니다. 여기Android : 본문 데이터를 본문으로 보내기 Google Volley
는 컬 내가 발리에서 그 -F 부분을 달성 할 수있는 방법
curl -X POST -H "Content-Type: multipart/form-data" -F "mobile_number=<XXXX>" "<server_url>"
입니까? 서버가 잘못된 요청을 던지고 있습니다.
이것은 내가 무엇을했는지 있습니다 :
final JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST, URLFactory.OTP_URL,
null, listener, errorListener){
@Override
public byte[] getBody() {
final JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("mobile_number", mobileNumber);
} catch (JSONException e) {
e.printStackTrace();
return null;
}
return jsonObject.toString().getBytes();
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
final HashMap<String, String> headers = new HashMap<>();
headers.put("Content-Type", "multipart/form-data");
return headers;
}
};
이 저를 도와주세요.
http://stackoverflow.com/questions/32240177/working-post-multipart-request-with-volley-and-without-httpentity?lq=1 ye를 읽었습니까? 티? – BNK