我想将请求方法从GET更改为POST.这是我的代码:
HttpURLConnection connection = null;
URL url = new URL("https://accounts.google.com/o/oauth2/token");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
Run Code Online (Sandbox Code Playgroud)
但正如您在调试请求的方法时在此图像中看到的那样不会改变:
