private void addValueForHeader(Map<String, Object> toAddTo, String key, Object value) {
      if (value != null && value instanceof String) {
        StringBuilder sb;
        if (toAddTo.get(key) == null) {
          sb = new StringBuilder(value.toString());
          toAddTo.put(key, sb);
        } else {
          sb = (StringBuilder) toAddTo.get(key);
          sb.append(MULTIPLE_HEADER_VALUE_DELIMITER).append(value);
        }
      } else if (value != null && toAddTo.containsKey(key)) {
        throw new IllegalStateException("Value of key [" + key + "] is not a string and it already exists in the args");
      } else {
        toAddTo.put(key, value);
      }
    }
Adds a value for a header.
@param toAddTo the map to add the {@code key} with value {@code value} to.
@param key the key for which {@code value} is a value.
@param value a value of {@code key}
ambry-tools/src/main/java/com/github/ambry/tools/perf/rest/PerfNioServer.java