通过代码授权用户:
String url = "http://localhost:4984/sync_gateway/_user/GUEST";
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
String urlParameters = "{\"disabled\":\"false\", \"admin_channels\":[\"public\"]}";
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();
执行后是代码得到响应代码:405,用户也没有被授权。请告诉我这是授权用户的正确方法吗?