0

Given the following code:

    private HttpsURLConnection buildConnection(final String urlString) throws MalformedURLException,

        IOException, ProtocolException {

    final URL url = new URL(urlString);

    final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();

    connection.setRequestMethod("POST");

    connection.setUseCaches(false);

    connection.setDoInput(true);

    connection.setDoOutput(true);
    connection.setChunkedStreamingMode(0);

    return connection;

}

Why does connection.method = "GET"? Any calls to addRequestProperty also seems to be ignored, as well.

This is using Android, Android Studio, on Windows to write the code (thus using whatever classes it downloads with the Android SDK, which should be the same as anyone else...)

Demortes
  • 161
  • 11

1 Answers1

0

I found that my problem was the debugging windows for some reason were not updating. The code was changing the variables in memory, but the debugging windows in Android Studio AND Eclipse failed to reflect correct information.

My problem ultimately stemmed from an authorization header using a capital I instead of a lowercase I, causing unauthorized to be returned and the debugging information not reflecting correct information ultimately messed with what I thought was wrong, and led me down a rabbit hole for two days.

Demortes
  • 161
  • 11