code: private static void addRequestProperties(final Map<String, String> requestProperties, final HttpURLConnection connection) {
          if (requestProperties != null) {
              for (Entry<String, String> entry : requestProperties.entrySet()) {
                  connection.addRequestProperty(entry.getKey(), entry.getValue());
              }
          }
      }
docs: Copies request properties to a connection.
  
  @param requestProperties
  (if null, connection will not be changed)
  @param connection