运行脚本时,我正在使用HttpURLConnection测试断开的链接,我收到的响应代码为200,但实际上为500
Request URL: https://rb-upgrade.extranet-system.com/v2/social/rooms
Request Method: GET
Status Code: 500
Remote Address: 54.79.47.209:443
Referrer Policy: no-referrer-when-downgrade
HttpURLConnection connection = (HttpURLConnection) new URL("https://rb-upgrade.extranet-system.com/v2/social/rooms").openConnection();
connection.setRequestMethod("GET");
connection.connect();
int iresponsecode = connection.getResponseCode();
我得到的int responsecode为200
如何确保我得到正确的响应代码,如开发者工具中所示。谢谢您的时间