Reputation: 241
I am trying to call a get API call using HttpURLConnection in android. I am passing some values as headers on the URL. This API returns not found response if that value contains special characters like & and #. All other special characters working fine. See below the method that I have used to call service.
URL url = new URL(strings[0]);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Authorization", "Bearer " + accessToken);
con.setRequestProperty("UserId", "787878");
con.setReadTimeout(15000);
con.setConnectTimeout(15000);
con.setDoOutput(false);
con.connect();
InputStream inputStream;
status = con.getResponseCode();
statusmsg = con.getResponseMessage();
Upvotes: 0
Views: 176