HttpUrlConnection inconsistent behavior on Android - how to debug?

I have a strange problem: When I implement the interface to the web server in the Android application, I connect to it using HttpsUrlConnection. The connection uses optional HTTP Basic authorization (using setRequestProperty ), but otherwise it's a simple GET request via HTTPS.

It works fine, using it on an emulator using Android 4.0.3, but does not work with the HTTP 400 "Bad request" error on Android 2.3.5 (both the emulator and the real device). I have no control over the server, so I do not understand what the problem is.

Has anyone ever encountered such a problem or know how to print / register a sent request?

TIA

Patrick

+4
source share
1 answer

You can configure a proxy server, such as a Fiddler or Charles proxy server (and I think there are Firefox extensions), and instead point your application to the proxy server. Even if you don’t actually configure it as a proxy server (so that the requests really work) while it captures the requests, you should be able to compare the difference between the requests made in 4.0.3 and 2.3. 5.

+4
source

Source: https://habr.com/ru/post/1399659/


All Articles