function addContentType(headerValue, entry) {
  var value = headerValue.split(";").shift().toLowerCase();
  entry.contentType = value;

  switch (value) {
    case "text/html":
      entry.type = "html";
      entry.isHTML = true;
      break;

    case "text/xml":
      entry.type = "xml";
      entry.isXML = true;
      break;

    case "text/css":
      entry.type = "css";
      entry.isCSS = true;
      break;

    case "application/x-javascript":
    case "application/javascript":
    case "text/javascript":
      entry.type = "js";
      entry.isJS = true;
      break;

    case "application/json":
      entry.type = "json";
      entry.isJSON = true;
      break;

    case "image/png":
    case "image/jpeg":
    case "image/gif":
    case "image/svg+xml":
    case "image/webp":
    case "image/avif":
      entry.type = "image";
      entry.isImage = true;

      if (value === "image/svg+xml") {
        entry.isSVG = true;
      }
      break;

    case "video/webm":
    case "video/mp4":
      entry.type = "video";
      entry.isVideo = true;
      break;

    // @see http://stackoverflow.com/questions/2871655/proper-mime-type-for-fonts
    case "application/font-wof":
    case "application/font-woff":
    case "application/font-woff2":
    case "application/vnd.ms-fontobject":
    case "application/x-font-opentype":
    case "application/x-font-truetype":
    case "application/x-font-ttf":
    case "application/x-font-woff":
    case "font/opentype":
    case "font/ttf":
    case "font/woff":
    case "font/woff2":
      entry.type = "webfont";
      entry.isWebFont = true;

      if (/ttf|truetype$/.test(value)) {
        entry.isTTF = true;
      }
      break;

    case "application/octet-stream":
      var ext = (entry.url || "").split(".").pop();

      switch (ext) {
        // @see http://stackoverflow.com/questions/2871655/proper-mime-type-for-fonts#comment-8077637
        case "otf":
          entry.type = "webfont";
          entry.isWebFont = true;
          break;
      }
      break;

    case "image/x-icon":
    case "image/vnd.microsoft.icon":
      entry.type = "favicon";
      entry.isFavicon = true;
      break;

    default:
      debug(
        "Unknown content type found: " + value + " for <" + entry.url + ">"
      );
  }

  return entry;
}
Detect response content type using "Content-Type header value"

@param {string} headerValue
@param {object} entry