code: public static String getSingleValuedHeader(
              Map<String, List<String>> headers, String key) {
          List<String> values = headers.get(key);
  
          if (values == null) {
              return null;
          }
  
          if (values.size() > 1) {
              throw new IllegalArgumentException("Header with key [\"" + key
                      + "\"] isn't single valued !");
          }
  
          return values.get(0);
      }
docs: Returns the value of the named header. If it has multiple values
  then an {@link IllegalArgumentException} is thrown
  
  @param headers the http headers map
  @param key the key of the header
  @return the value of the http header