1

I'm using volley library and overriding getHeaders() method to put custom headers. It is working fine for devices with API > 10 but for devices with API 10 it returns unexpected response code 400.

The headers in https are the same for devices with API 17 and API 10. I have also updated the volley lib to newest version, but with no luck.

In getHeaders() method I'm putting

String encodedCredentials = Base64.encodeToString(credentials.getBytes(), Base64.DEFAULT);
headerMap.put("Authorization", "Basic " + encodedCredentials); 

Do you have any suggestion how to solve this problem?

Daniel
  • 31
  • 1
  • 4

1 Answers1

2

So I have found the problem. For android API 10 the headers from https request were cut off. The only header was Authorization that was added manually.

I have changed Base64.DEFAULT to Base64.NO_WRAP and it is working now. I have found the answere here:

How to do HTTP authentication in android?

Community
  • 1
  • 1
Daniel
  • 31
  • 1
  • 4