目前我正在使用以下代码来获取响应。
public static String LinkCheacker(String URLString) throws IOException {
String Status;
try {
URL url = new URL(URLString);
HttpURLConnection http = (HttpURLConnection) url.openConnection();
http.setRequestMethod("GET");
http.connect();
Status = http.getResponseCode() + ":" + http.getResponseMessage();
http.disconnect();
} catch (Exception e) {
Status = ":some error:" + e.getMessage();
}
return Status;
}
我有更多 API 来测试身份验证(使用 userId、密码登录),我该如何测试它们?请帮助我。