title: Android : Sending form-data as body Google Volley
body: <p>In my Android application, I am using google's volley for network operations. There is a case where I need to make a request but send body as form-data.
  I have tried everything else, but I am not able to make the request as form-data.</p>
  
  <p>Here is a curl </p>
  
  <pre><code>curl -X POST -H "Content-Type: multipart/form-data" -F "mobile_number=&lt;XXXX&gt;" "&lt;server_url&gt;"
  </code></pre>
  
  <p>How can I achieve that -F part in volley? The Server is throwing bad request.</p>
  
  <p>This is what I have done : </p>
  
  <pre><code>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&lt;String, String&gt; getHeaders() throws AuthFailureError {
                  final HashMap&lt;String, String&gt; headers = new HashMap&lt;&gt;();
                  headers.put("Content-Type", "multipart/form-data");
                  return headers;
              }
          };
  </code></pre>
  
  <p>Please help me in this.</p>