Fixes an issue for Android <= KITKAT when updating profile.

This commit is contained in:
stom79 2018-03-02 15:17:13 +01:00
parent a809b2bb84
commit c4d230a9e6
1 changed files with 7 additions and 1 deletions

View File

@ -1022,7 +1022,13 @@ public class HttpsConnection {
httpsURLConnection.setRequestProperty("User-Agent", Helper.USER_AGENT);
httpsURLConnection.setConnectTimeout(timeout * 1000);
httpsURLConnection.setSSLSocketFactory(new TLSSocketFactory());
httpsURLConnection.setRequestMethod("PATCH");
if( Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT ){
httpsURLConnection.setRequestMethod("PATCH");
}else {
httpsURLConnection.setRequestProperty("X-HTTP-Method-Override", "PATCH");
httpsURLConnection.setRequestMethod("POST");
}
if (token != null)
httpsURLConnection.setRequestProperty("Authorization", "Bearer " + token);
httpsURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");