function parseAcceptEncoding(accept) {
  const accepts = accept.split(",");
  let hasIdentity = false;
  let minQuality = 1;
  const parsedEncodings = [];
  for (let i = 0; i < accepts.length; i++) {
    const encoding = parseEncoding(accepts[i].trim(), i);
    if (encoding) {
      parsedEncodings.push(encoding);
      hasIdentity = hasIdentity || specify("identity", encoding);
      minQuality = Math.min(minQuality, encoding.q || 1);
    }
  }
  if (!hasIdentity) {
    /*
     * If identity doesn't explicitly appear in the accept-encoding header,
     * it's added to the list of acceptable encoding with the lowest q
     */ parsedEncodings.push({
      encoding: "identity",
      q: minQuality,
      i: accepts.length,
    });
  }
  return parsedEncodings;
}
/**
 * Parse the Accept-Encoding header.
 */
Parse the Accept-Encoding header.
Parse the Accept - Encoding header .
function parseAcceptEncoding(accept) {
  const accepts = accept.split(",");
  let hasIdentity = false;
  let minQuality = 1;
  const parsedEncodings = [];
  for (let i = 0; i < accepts.length; i++) {
    const encoding = parseEncoding(accepts[i].trim(), i);
    if (encoding) {
      parsedEncodings.push(encoding);
      hasIdentity = hasIdentity || specify("identity", encoding);
      minQuality = Math.min(minQuality, encoding.q || 1);
    }
  }
  if (!hasIdentity) {
     parsedEncodings.push({
      encoding: "identity",
      q: minQuality,
      i: accepts.length,
    });
  }
  return parsedEncodings;
}
function parseAcceptEncoding ( accept ) { const accepts = accept . split ( "," ) ; let hasIdentity = false ; let minQuality = 1 ; const parsedEncodings = [ ] ; for ( let i = 0 ; i < accepts . length ; i ++ ) { const encoding = parseEncoding ( accepts [ i ] . trim ( ) , i ) ; if ( encoding ) { parsedEncodings . push ( encoding ) ; hasIdentity = hasIdentity || specify ( "identity" , encoding ) ; minQuality = Math . min ( minQuality , encoding . q || 1 ) ; } } if ( ! hasIdentity ) { parsedEncodings . push ( { encoding : "identity" , q : minQuality , i : accepts . length , } ) ; } return parsedEncodings ; }
Parse the Accept-Encoding header.
Parse the Accept - Encoding header .
/*
     * If identity doesn't explicitly appear in the accept-encoding header,
     * it's added to the list of acceptable encoding with the lowest q
     */