I am using the following url for a GET request:
String url = "http://10.0.2.2:8080/api/v1/user/login?username=" + username + "&password=" + password;
It looks like the user may choose a username / password such that it will cause the url to have different meaning in terms of the parameter names and values.
For example: I have noticed that if username = "&"
and password = 1
then the login request returns false.
I have tried passing parameters using the following code:
@Override
public Map<String, String> getParams() {
Map<String, String> params = new HashMap<>();
params.put("username", username);
params.put("password", password);
return params;
}
But this method does not work with GET requests.
Is there anyway to encapsulate the variables in the url string? Or should I change the method in the server to a POST method?