Doing a Post ends up with empty parameters

1,954 views
Skip to first unread message

envya...@gmail.com

unread,
May 16, 2014, 4:21:05 PM5/16/14
to volley...@googlegroups.com
Hi guys

Have anyone had this problem with empty parameters when doing a post?
I have an app that uses the volley lib for posting some parameters and headers to a server.

When the app is in debug mode, and testing volley against a localhost node server over HTTP, it works perfectly.

But when the app is in production mode, with volley requests going against a remote node server (exact same code as the local one), and with HTTPS, the parameters turns up empty on the server...

The request is made, and the header still works though... but the post body/json params are now empty.

Here is the code (a bit edited) that im using:
Has anyone experienced this before?


Map<String, String> jsonParams = new HashMap<String, String>();
jsonParams.put("param1", string1);
jsonParams.put("param2", string2);

JsonObjectRequest registerRequest = new JsonObjectRequest(Request.Method.POST,
        new JSONObject(jsonParams),
        new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                registrationSuccess(response);
            }
        },
        new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                registrationFailed(error);
            }
        }) {
    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        HashMap<String, String> headers = new HashMap<String, String>();
        headers.put("Content-Type", "application/json");
        headers.put("User-agent", "My useragent");
        return headers;
    }
};
MyApplication.getInstance().addToRequestQueue(registerRequest, "tag");

envya...@gmail.com

unread,
May 23, 2014, 4:58:44 PM5/23/14
to volley...@googlegroups.com
Think  I managed to solve the problem!

I wrote about it here:
Reply all
Reply to author
Forward
0 new messages