I am sending a request to server and getting Collection + Json in responce. Every thing is perfect in PostMan.
But when I am doing same things in code using OKHTTP, I am getting some unreadable characters.
Here is my code
OkHttpClient client = new OkHttpClient();
requestBody = new FormBody.Builder()
.add("email", email)
.add("password", psd)
.build();
Request request = new Request.Builder()
.url(url)
.addHeader("Accept", "application/vnd.collection+json")
.addHeader("Accept-Encoding", "gzip")
.addHeader("Authorization", "Basic YWRtaW46cmVhbHNlYw==")
.post(requestBody)
.build();
try {
Response response = client.newCall(request).execute();
String s = response.body().string();
response.body().close();
} catch (Exception e) {
e.printStackTrace();
}
I tried some other url and those are working perfect.
many thanks.