HttpsUrlConnection 不支持 SetRequestMethod?
HttpsUrlConnection Does not Support SetRequestMethod?
我写了一个代码来建立一个 HttpsUrlConnection
和 setRequestMethod
作为 PUT
。在调试时,我看到该方法为 GET
。我的 SetRequestMethod
不工作。我不知道为什么 HttpsUrlConnection
默认方法 GET
.
我的代码是这样的
DisbleSSL disble = new DisbleSSL();
disble.disableSSLVerification();
URL url = new URL(url_string);
httpsUrlConnection = (HttpsURLConnection) url.openConnection();
httpsUrlConnection.setDoOutput(true);
httpsUrlConnection.setRequestMethod("PUT");
httpsUrlConnection.connect();
在 setDoOutput 之前尝试 setRequestMethod
HttpsUrlConnection 肯定支持 setrequestMethod.Actually 但它可能在调试控制台中标记错误。
我写了一个代码来建立一个 HttpsUrlConnection
和 setRequestMethod
作为 PUT
。在调试时,我看到该方法为 GET
。我的 SetRequestMethod
不工作。我不知道为什么 HttpsUrlConnection
默认方法 GET
.
我的代码是这样的
DisbleSSL disble = new DisbleSSL();
disble.disableSSLVerification();
URL url = new URL(url_string);
httpsUrlConnection = (HttpsURLConnection) url.openConnection();
httpsUrlConnection.setDoOutput(true);
httpsUrlConnection.setRequestMethod("PUT");
httpsUrlConnection.connect();
在 setDoOutput 之前尝试 setRequestMethod
HttpsUrlConnection 肯定支持 setrequestMethod.Actually 但它可能在调试控制台中标记错误。