我正在尝试通过 Android 发送一个 GET HttpURLConnection
(从 导入org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection
),并在收到响应后,抛出一个IOException:
在 doRequestInternal() 中:“收到的身份验证质询为空”
这个错误是什么意思,是什么原因造成的?我正在将 OAuth 参数写入 Authorization 标头,但我在其他场合也这样做,没有问题。
if (connection == null) {
connection = (HttpURLConnection) new URL(endpointUrl).openConnection();
connection.setRequestMethod("GET");
}
//... do some OAuth message signing
connection.connect();
int statusCode = connection.getResponseCode(); // throws IOException