title: Request Delete using Volley Android
body: <p>I try to send a DELETE Request using Volley to a REST Api with parameters like X-user-email and X-User-token. I have tried almost everything on Internet but still I am getting a 400 error Message.</p>
  
  <p>When i use the POST Request its work, so i think its the same for the DELETE, i just changed:</p>
  
  <pre><code>(Request.Method.POST, url, params, new Response.Listener&lt;JSONObject&gt;() {...}
  </code></pre>
  
  <p>by</p>
  
  <pre><code>(Request.Method.DELETE, url, params, new Response.Listener&lt;JSONObject&gt;() {...}
  </code></pre>
  
  <p>There is my following code:</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>disconnect.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {;
                  JSONObject params = new JSONObject();
                  try {
                      params.put("X-User-Email", "test@test.com");
                      params.put("X-User-Token", "QwerTyuI789IOP");
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
                  NetworkManager.getInstance(v.getContext()).delete("http://10.0.2.2:3000/users/sign_out", params, new NetworkManager.NetworkManagerListener&lt;String&gt;()  {
                      @Override
                      public void getResult(String response)
                      {
                          if (!response.isEmpty())
                          {
                              result.setText(response.toString());
                              Log.e("Response", response.toString() );
                          }
                      }
                  });
              }
          });
  </code></pre>
  
  <p>NetworkManager.java</p>
  
  <pre><code>public void delete(String url, JSONObject params, final NetworkManagerListener&lt;String&gt; listener) {
          JsonObjectRequest request = new JsonObjectRequest
                  (Request.Method.DELETE, url, params, new Response.Listener&lt;JSONObject&gt;() {
                      @Override
                      public void onResponse(JSONObject response) {
                          Log.d(TAG + ": ", "delete onResponse : " + response.toString());
                          if (null != response.toString())
                              listener.getResult(response.toString());
                      }
                  }, new Response.ErrorListener() {
  
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          if (null != error.networkResponse) {
                              Log.d(TAG + ": ", "delete Error Response code: " + error.networkResponse.statusCode);
                              listener.getResult(error.toString());
                          }
                      }
                  }) {
              @Override
              public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put("Accept", "application/json");
                  params.put("Content-type", "application/json");
                  return params;
              }
          };
          ;
          requestQueue.add(request);
      }
  </code></pre>
  
  <p>Do you know how to fix that? thank you to read me.</p>