public static ContentType of(String str) {
    if (str == null) {
      return UNDEFINED;
    }

    val trimmed = str.trim();
    for (val type : values()) {
      if (trimmed.startsWith(type.getHeader())) {
        return type;
      }
    }
    return UNDEFINED;
  }
Parses string to content type.

@param str string representation of content type.
@return {@link ContentType} instance or {@link ContentType#UNDEFINED}, if there is no such
    content type.
form/src/main/java/feign/form/ContentType.java