I am using DavidWebb for making Http POST requests. I have ArrayList or HashMap for all the params that I want to send. How can I pass an array of params using DavidWebb?
Right now I am doing this like
Response<String> resp = webb
.post(Constants.URL + Constants.CUSTOMER_SIGNUP)
.param("username", params.get("username"))
.param("user_contact_no", params.get("user_contact_no"))
I want to do something like
Response<String> resp = webb
.post(Constants.URL + Constants.CUSTOMER_SIGNUP)
.arraylist/hasmap of params
I found the solution. "Andy Turner"'s answer clicked.
Request request = webb
.post(Constants.URL + Constants.CUSTOMER_SIGNUP);
for (Map.Entry<String, String> entry : params.entrySet()) {
request.param(entry.getKey(), entry.getValue());
}
Response<String> resp = request.readTimeout(30000)
.connectTimeout(30000)
.asString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With