code: protected String perform(String method, String request) throws IOException {
          HttpURLConnection connection = (HttpURLConnection) from.openConnection();
          connection.setRequestMethod(method);
          connection.setDoOutput(true);
          if (contentType == null)
              contentType = "text/plain; charset=utf8";
          connection.setRequestProperty("Content-Type", contentType);
  
          try (OutputStream urlOut = connection.getOutputStream()) {
              urlOut.write(request.getBytes());
              urlOut.flush();
              InputStream urlIn = connection.getInputStream();
              ByteArrayOutputStream resp = new ByteArrayOutputStream();
              byte[] buffer = new byte[1024];
              int len = urlIn.read(buffer);
              while (len >= 0) {
                  resp.write(buffer, 0, len);
                  len = urlIn.read(buffer);
              }
              return resp.toString();
          }
      }
docs: For PUT/POST.